javascript - popup image not changing issue -
i trying create popup under popup when try adding thing in place of images not display old image appears. close link not working. knows why happening below code
// modal var modal = document.getelementbyid('mymodal'); // button opens modal var btn = document.getelementbyid("mybtn"); // <span> element closes modal var span = document.getelementsbyclassname("close")[0]; // when user clicks button, open modal btn.onclick = function() { modal.style.display = "block"; } // when user clicks on <span> (x), close modal span.onclick = function() { modal.style.display = "none"; } // when user clicks anywhere outside of modal, close window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } // modal var modal = document.getelementbyid('mymodal'); // button opens modal var btn = document.getelementbyid("mybtn2"); // <span> element closes modal var span = document.getelementsbyclassname("close")[0]; // when user clicks button, open modal btn.onclick = function() { modal.style.display = "block"; } // when user clicks on <span> (x), close modal span.onclick = function() { modal.style.display = "none"; } // when user clicks anywhere outside of modal, close window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } }
/* modal (background) */ .modal { display: none; /* hidden default */ position: fixed; /* stay in place */ z-index: 1; /* sit on top */ padding-top: 100px; /* location of box */ left: 0; top: 0; width: 100%; /* full width */ height: 100%; /* full height */ overflow: auto; /* enable scroll if needed */ background-color: rgb(0, 0, 0); /* fallback color */ background-color: rgba(0, 0, 0, 0.4); /* black w/ opacity */ } /* modal content */ .modal-content { background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888; width: 80%; } /* close button */ .close { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; } #thumbwrap { margin: 75px auto; width: 1190px; height: 1190px; } .thumb { float: left; /* must floated same cross browser position of larger image */ /* position:relative;*/ margin: 3px; } .thumb img { border: 1px solid #000; vertical-align: bottom; } .thumb:focus { border: 0; /* ie6 needs show large image */ z-index: 1; } .thumb span { position: absolute; visibility: hidden; width: 70%; height: 50%; background: grey; } .thumb:focus span { visibility: visible; top: 130px; left: 100px; } .thumb .x { position: absolute; top: -11px; z-index: 1101; margin: 0px; }
<h2>modal example</h2> <!-- trigger/open modal --> <img id="mybtn" src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg"> <!-- modal --> <div id="mymodal" class="modal"> <!-- modal content --> <div class="modal-content"> <span class="close">×</span> <p>some text in modal..</p> <div id="thumbwrap"> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt="">jhkjgvfhgcgbfxfdzds\dcs</span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> </div> </div> </div> <h2>modal example</h2> <!-- trigger/open modal --> <img id="mybtn2" src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg"> <!-- modal --> <div id="mymodal" class="modal"> <!-- modal content --> <div class="modal-content"> <span class="close">×</span> <p>some text in modal..</p> <div id="thumbwrap"> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-.jpg" alt=""><span><iframe width="560" height="315" src="https://www.youtube.com/embed/qjzbjhrec7k" frameborder="0" allowfullscreen></iframe>jhkjgvfhgcgbfxfdzds\dcs<a class="x" href="#thumbwrap" data-rel="back" style="display:block;">close</a></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> <a class="thumb" href="#"> <img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""><span><img src="http://www.websitecodetutorials.com/code/images/jamie-small1.jpg" alt=""></span> </a> </div> </div> </div>
Comments
Post a Comment