Jquery “live” gotchas with Colorbox
If you have a script like the following with large_popup as the css class of your hyperlink.
$(document).ready(function() {
$(". large_popup").live('click', function(e) {
e.preventDefault();
$(this).colorbox({
overlayClose: false,
close: "x",
open: true,
transition: "none",
width: "995px"
});
});
});
Change it to:
$(document).ready(function () {
$(".large_popup").live('click', function (e) {
e.preventDefault();
$.colorbox({href: this.href,
overlayClose: false,
close: "x",
open: true,
transition: "none",
width: "995px"
});
});
});
Otherwise, multiple colorbox calls fire everytime you click that link.
Advertisement
Categories: Uncategorized