Reputation: 1
i try to use This code. It works good with 1 window, but i need 2 popup window.
i try to modified it like this
$(document).ready(function(){
PopUpHide();
});
function PopUpShow(){
$("#popup1").show();
$("#popup2").show();
}
function PopUpHide(){
$("#popup1").hide();
$("#popup2").hide();
}
And HTML
<div class="b-container">
Sample Text
<a href="javascript:PopUpShow()">Show popup</a>
</div>
<div class="b-popup" id="popup1">
<div class="b-popup-content">
Text in Popup
<a href="javascript:PopUpHide()">Hide popup</a>
</div>
</div>
<div class="b-container">
Sample Text
<a href="javascript:PopUpShow()">Show popup</a>
</div>
<div class="b-popup" id="popup2">
<div class="b-popup-content">
Text in Popup
<a href="javascript:PopUpHide()">Hide popup</a>
</div>
</div>
Where i make mistake?
Upvotes: 0
Views: 232
Reputation: 1
$(document).ready(function(){
PopUpHide();
});
function PopUpShow1(){
$("#popup1").show();
function PopUpShow2(){
$("#popup2").show();
}
function PopUpHide(){
$("#popup1").hide();
$("#popup2").hide();
}
In the end i make like this
Upvotes: 0
Reputation: 54
You're most probably showing two popups above each others, give one of them different position and class and use different Javascript function to show each, or send a variable to the function to decide which one to view.
Would be something like that:
function popupshow(whichOne)
{
if(whichOne == 'first'){
$("#popup1").show();
$("#popup2").hide();
}
else{
$("#popup1").hide();
$("#popup2").show();
}
}
UPDATE: here's the fiddle code as you requested. http://jsfiddle.net/jBf2y/2/
Upvotes: 1
Reputation: 15
Your code above is working. You just need to set a margin to #popup2 div. They bot appear together, but as they are in the same position, you only see one of them.
Upvotes: 0