Reputation: 3
We are trying to add two fancybox inline pop-ups to our website. We got one working, but we aren't able to get the second one working. Could you please look at our code?
For html we written the following:
<a id="popup-inline" href="#data"><div class="button">Click here</div></a><br><br>
<div style="display:none">
<div id="data">
TEXT
</div>
</div>
<a id="popup-inline" href="#data1"><div class="button">Click here</div></a><br><br>
<div style="display:none">
<div id="data1">
TEXT1
</div>
</div>'
Furthermore our jquery is:
$(document).ready(function() {
$("#popup-inline").fancybox({
'titlePosition' : 'inside' });
});
</script>
Upvotes: 0
Views: 1553
Reputation: 318182
ID's are unique, so change it to a class for both elements:
<a class="popup-inline" ...
and do:
$(".popup-inline").fancybox({
'titlePosition' : 'inside'
});
jQuery (and javascript in general) only finds the first element when using the same ID twice, as anything else is invalid markup, and not expected.
Upvotes: 2
Reputation: 878
what @adeneo said is correct. Also you should not put a hidden div around the elements that contain the inline fancybox content:
<div id="data1" style="display:none">
TEXT1
</div>
Upvotes: -1