WordPress.org

Ready to get started?Download WordPress

Forums

FancyBox for WordPress
[resolved] Patch: Disabling fancybox on selected images (2 posts)

  1. archon810
    Member
    Posted 2 years ago #

    I needed to disable fancybox on certain images and after finding that this isn't possible with the default plugin, I dug into the code and patched it (version 3.0.1).

    Find:

    // Supported file extensions
    var thumbnails = jQuery("a:has(img)").filter( function() { return /(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr('href')) });

    Add after jQuery("a:has(img)"):
    .not(".nolightbox")

    Final result:

    // Supported file extensions
    var thumbnails = jQuery("a:has(img)").not(".nolightbox").filter( function() { return /(jpe?g|png|gif|bmp)$/i.test(jQuery(this).attr('href')) });

    Now, in your post's HTML, add class='nolightbox' and optionally target='_new' to the <a> element, and it will no longer be fancyboxed.

    Enjoy!

    http://wordpress.org/extend/plugins/fancybox-for-wordpress/

  2. archon810
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic