How do I open fancybox via manual call for a gallery in the html not via the jquery options?

前端 未结 2 1283
小鲜肉
小鲜肉 2020-12-04 01:15

I am just looking at the fancybox v2 at the moment.

I am trying to get a gallery to load with fancybox but with manual call. I dont want the gallery images to be loa

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 01:48

    If you want to / have to use older jQuery Versions (e.g. because of a Drupal Module) get rid of the .on() and use

    < a href="javascript:;" id="launcher">LINK TO TOPEN GALLERY< /a>
    

    and

    jQuery(document).ready(function($) {
        $("#launcher").click(function() {
            $(".imagefield-fancybox").eq(0).trigger("click");
        });
    });
    

    instead.

    Works also with older jQuery Versions. Replace ".imagefield-fancybox" with the class you are using.

提交回复
热议问题