Easy FancyBox
[resolved] Limit Easy Fancybox to certain images (4 posts)

  1. Trishah
    Posted 3 years ago #

    I'm using a shopping cart that already has it's own shadowbox effect for images. I want to limit Easy Fancybox to only certain images on the site outside the cart.

    I have tried unchecking "Images & Inline content" then adding the class="fancybox" to certain images but that is not working. I've checked in both FireFox v17 and Chrome v20.

    Any ideas how to accomplish this?


  2. RavanH
    Plugin Author

    Posted 3 years ago #

    You'll have to clear the field where the autodetectable file types are defined (.jpg .png etc.) and then autodetection for images will be off. Then, only links that have your set class='fancybox' will work.

  3. Trishah
    Posted 3 years ago #

    Oh... I see now... What I did was uncheck "Enable FancyBox for Images & Inline content" and use the class on the images. But what I should have done was keep that checked and remove the image extensions from the "Images & Inline content: Auto-detect" input field.

    What I did instead was to use functions.php to keep Easy Fancybox from being active in the shopping cart folders that already have a shadowbox on images. This way I don't have to add the class to every image. Here is that solution if anyone is interested:

    function stop_easy_fancybox() {
    if(preg_match("/\/folder_name_1\//",$_SERVER['REQUEST_URI']) ||
            remove_action('wp_print_styles', 'easy_fancybox_enqueue_styles', 999);
            remove_action('wp_enqueue_scripts', 'easy_fancybox_enqueue_scripts', 999);
            remove_action('wp_head', 'easy_fancybox', 999);
  4. RavanH
    Plugin Author

    Posted 3 years ago #

    Thanks for sharing Trishah.

    You can also use a class to prevent fancybox from being attached: class="nofancybox" ... handy for those cases where you only occasionally want to disable FancyBox ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic