Let's review what you posted;
Code:
<div id="img1" class="hide"><img src="http://www.katiebuglove.com/Katies/FreeTubes/brvig2015.jpg"/>[<a onclick="hideModal('img1');"><div class="close">Close Window</a>]</div></div>
along with this in you stylesheet;
Code:
div.close { width:100%; height:100%; display:block; position:absolute; }
I replied and changed your markup to this, removing the extra div and putting the class on the anchor tag instead;
Code:
<div id="img1" class="hide"><img src="http://www.katiebuglove.com/Katies/FreeTubes/brvig2015.jpg"/><a onclick="hideModal('img1');" class="close">Close Window</a></div>
So now, your CSS doesn't work because it's looking for a div with the .close class - you need to update it for the anchor tag. Just to clarify, an anchor tag is a tag that begins with <a ... - also called a link/hyperlink.
but all the new window pictures are the same (image one). My guess is the change "showModal('img1'" to 2 and 3. Would this be correct?
Yes
Code:
<a href="javascript:void(0)" onclick="showModal('img1')">View Image</a>
opens
Code:
<div id="img1" class="hide"><img src="pic1.jpg"/><a onclick="hideModal('img1');" class="close">Close Window</a></div>
And
Code:
<a href="javascript:void(0)" onclick="showModal('img2')">View Image</a>
opens
Code:
<div id="img2" class="hide"><img src="pic2.jpg"/><a onclick="hideModal('img2');" class="close">Close Window</a></div>
and you only need
Code:
<script>
function showModal(id) { document.getElementById(id).className = 'show'; }
function hideModal(id) { document.getElementById(id).className = 'hide'; }
</script>
ONCE at the bottom of your web page.
BTW - are you aware of the official "thanks" buttons on the bottom left corner of all posts? If you're finding these replies helpful, it would be great if you could show your thanks officially
Bookmarks