Hey guys, I am trying to use JQuery to manage some popups. This page I am building will have 15 projects, each which is a thumbnail contained within a DIV. Each DIV has a Name attribute so I would like to have JQuery find the name of the DIV and activate the hidden popup with the same name that is contained within the ID…
Currently I have three "projectThumb" DIVs with different names and three different "projectPopup" DIVs with the same corresponding names as the "projectThumb" DIVs but placed in the ID tag.
HTML Code:
<div class="projectThumb">
<img src="/img/a.effect_static.gif" class="button" name="a.effect" alt="" />
<p class="title">A.EFFECT: Film Poster</p>
</div>
<div class="projectPopup" id="a.effect">
<a class="close">Close ×</a>
<img src="/img/a.effect_popup.jpg" alt="" />
<p class="description">Description</p>
</div>
JScript and JQuery code:
var popupStatus = 0;
function loadPopup(){
if(popupStatus==0){
$(".projectPopup").show();
popupStatus = 1;
}
}
function closePopup(){
if(popupStatus==1){
$(".projectPopup").hide();
popupStatus = 0;
}
}
$(document).ready(
function(){
var findProject = $(".projectThumb").find('img').attr('name');
$(".projectThumb", this).click(function(){
loadPopup();
});
});
Thank you all in advance for any help!