My idea is as follows, I'm opening an image in a modalBox (or Box image, sorry to say something incorrect because I'm new to the subject) in javascript, how do I call the zoom function after calling the modal box function?
Thank you.
Below is the code I am using:
running here
<span class='zoom' id='ex3'>
<img id="myImg" src="img/map1.jpg" alt="Trolltunga, Norway" width="300" height="200">
<p>Hover</p>
</span>
<div id="myModal" class="modal">
<span class="close">×</span>
<img class="modal-content" id="img01">
<div id="caption"></div>
</div>
Javascript:
// Get the modal
var modal = document.getElementById('myModal');
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById('myImg');
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
var
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.src;
captionText.innerHTML = this.alt;
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
And this is the function I want to call:
Speak you want this function: // Zoom function
$(document).ready(function(){
$('#ex3').zoom({ on:'click' });
});
// End of Function