Support » Plugin: FancyBox for WordPress » Fancybox and Revolution Slider

  • Hello,

    I’m using fancybox 3.2.0 and followed the guide in this link https://www.themepunch.com/faq/using-fancybox-with-slider-revolution/ to use it with revolution slider (now version 5.4.8.3). The varition described in the guide i am using is “Open the lightbox when the slide’s main background is clicked”.

    I’m getting the console error “Uncaught TypeError: $this.addClass(…).attr(…).fancybox is not a function” in the pages i have my sliders.

    The javascript code i have added to my revolution slider settings is

    /* change revapi1 to whatever API name is being used for your slider */
    var api = revapi1;

    /* no need to edit below unless you want to change the default FancyBox settings */
    api.on(‘revolution.slide.onloaded’, function() {

    jQuery(this).find(‘.fancybox’).each(function() {

    var $this = jQuery(this);
    if(!$this.is(‘a’)) $this = $this.removeClass(‘fancybox’).find(‘a’);

    $this.addClass(‘fancybox’).attr(‘data-fancybox’, ‘gallery’).fancybox({

    /* begin FancyBox options */
    width: ‘auto’,
    height: ‘auto’,
    autoSize: true,
    aspectRatio: true,
    fitToView: true,
    autoCenter: true,
    scrolling: ‘no’,
    titleShow: ‘true’,
    afterClose: function() {api.revresume()}

    }).on(‘click’, function() {api.revpause()});

    });

    });

    I also have added the fancybox class to my slides and the correct link address.

    Can you please help me? This configurations worked some time ago, but now they don’t. Maybe when i updated to fancybox 3, but i can’t say for sure.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support mplusb

    (@mplusb)

    Hello @dnarra,

    To avoid incompatibilities between this plugin and others that use fancybox we renamed the class and function to: fancyboxforwp

    Changing it should fix it.

    All the best,
    Mihaela

    Hello Mihaela,

    It seems that your fix solved the “Uncaught TypeError: $this.addClass(…).attr(…).fancybox is not a function” problem, and i thank you for that.

    I would only like to know one more thing. How can i make the gallery to work? Even though I have “.attr(‘data-fancybox’, ‘gallery’)” in the code, fancybox only opens a slide at a time, it doesn’t navigate through all slides when it’s open. Any advice on how to make this work?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fancybox and Revolution Slider’ is closed to new replies.