main content, site navigation, search

Hide Flash banners when launching Fancybox modal

When launching image modal with Fancybox, Flash banners delivered from a third-party ad server could take over the top layer, covering the portion of the enlarged image.

The workaround is easy, but it’s not well documented. It’s done by Fancybox’s own callback options.

$('a[href$=".jpg"]').fancybox({
    onStart: function() { $('.banner object, .banner embed').hide(); },
    onClosed: function() { $('.banner object, .banner embed').show(); }
});

Other Fancybox callback options:
onStart, onCancel, onComplete, onCleanup and onClosed.

See it in action at Gadgeterija.net.

First voice to “Hide Flash banners when launching Fancybox modal”

  1. Kresimir Katusic
    001—2011.03.23.23:34

    Thx for this snippets.

main content, site navigation, search