• Hello,

    we have an issue with fancybox. We use this plugin and it works fine.

    But we want to open die lightbox automatically when a user visits the site. The popup should appear directly.
    I don’t get it work. With this code the popup works but the lightbox (fancybox-container) is opening three times? What’s wrong with that?

    ———————–
    This is my code:
    <div class=”redbox” ><p>Button-Text</p></div>

    <div id=”lightbox” style=”display:none;”>
    <class=”inside”>LIGHTBOX CONTENT</div>
    </div>

    <script type=”text/javascript”>
    $(document).ready(function () {
    var callFancy = jQuery(‘a[id=”lightbox-button”]’);
    callFancy.trigger(‘click’);
    });
    </script>

    —————————
    With this script it doesn’t work, there is no popup.

    <script type=”text/javascript”>
    $(document).ready(function() {
    $(“#lightbox-button”).fancybox().trigger(‘click’);
    });
    </script>

    I don’t know what I should do anymore.

    I hope you can help me. Thanks a lot. I searched for answers via google but everything doesn’t work.

    Best regards

    Martina

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter MB Mediendesign

    (@creesh)

    I’m sorry the ‘redbox’ button is displayed wrong, this is the code for the button:

    <a data-fancybox data-src="#lightbox" id="lightbox-button" href="javascript:;"><div><p>Button-Text</p></div></a>

    Plugin Support Miha

    (@mplusb)

    Hello @creesh,

    Can you please remove data-fancybox from the button?
    Let me know if this fixes it.

    Thank you,
    Mihaela

    Thread Starter MB Mediendesign

    (@creesh)

    Hello @mplusb,

    thank you very much.
    Removing data-fancybox doesn’t work. The lightbox is not working anymore without this code. Seems that this is necessary.

    Best regards

    Martina

    Thread Starter MB Mediendesign

    (@creesh)

    Hello,

    I solved the problem.

    <a data-fancybox data-src="#lightbox" id="lightbox-button" href="javascript:;"><div><p>Button-Text</p></div></a>

    Don’t use p- and div-tags in an a-Tag. That will open the lightbox with 3 layers background.

    Also I wrote the code this way:
    <a data-fancybox data-touch="false" id="lightbox-button" href="#lightbox">BUTTON-TEXT</a>

    Now it works perfect! ??

    Plugin Support Miha

    (@mplusb)

    Thank you for sharing this solution! We appreciate it.

    Rock on,
    Mihaela

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Open Fancybox automatically’ is closed to new replies.