Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Rameshwar-ghodke/3197d3c28d696019e6278d589d422666 to your computer and use it in GitHub Desktop.
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
// 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