Created
September 24, 2021 10:03
-
-
Save Rameshwar-ghodke/3197d3c28d696019e6278d589d422666 to your computer and use it in GitHub Desktop.
On image onclick function get image src path and display large image on modal popup using javascript function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// css | |
<style>.cloimg{position: absolute;top: 0;right: 22px;font-size: 36px;opacity: 1; background-color: #ffffff!important; padding: 8px; border-radius: 0px;}</style> | |
//html | |
<img onclick="getImgSrc(this)" class="img-fluid img-thumbnail" src="<?php echo $base_url;?><?php echo PLUGINS; ?>images/gallery/img_2.png" alt='pmpml gallery image'> | |
//Js | |
<script> | |
function getImgSrc(param){ | |
var imgpath = $(param).attr("src"); | |
// alert(imgpath); | |
document.getElementById("getimgsrc").setAttribute("src", imgpath); | |
$('#galmodal').modal('show'); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment