简体   繁体   中英

How to insert .fancybox-thumbs into .fancybox-inner using fancybox-3 plugin?

I am using fancybox-3 plugin with custom template:

  $().fancybox({
    selector : '[data-fancybox="images"]',
    animationEffect   : "fade",
    animationDuration : 330,
    transitionEffect : 'slide',
    thumbs     : true,
    fullScreen : false,
    slideShow  : false,
    loop:true,

    touch : {
        vertical : false,
        horizontal : false
    },

    thumbs : {
        autoStart : true
    },

    clickOutside : 'close',
    baseTpl :
     '<div class="fancybox-container qv-container" role="dialog" tabindex="-1">' +
     '<div class="fancybox-bg"></div>' +
     '<div class="fancybox-inner">' +
     '<button data-fancybox-prev title="{{PREV}}" class="fancybox-arrow fancybox-arrow--left" />' +
     '<button data-fancybox-next title="{{NEXT}}" class="fancybox-arrow fancybox-arrow--right" />' +
     '<button data-fancybox-close class="qv-close"></button>' +
     '<div class="fancybox-stage"></div>' +
     '</div>' +
     '</div>'

});

Still DOM is looking like: 在此处输入图片说明

I am trying to insert <div class="fancybox-thumbs">...</div> into <div class="fancybox-inner">...</div> to make DOM look same like in dev tools:

在此处输入图片说明

I have tried various versions of $(".fancybox-thumbs").appendTo(".fancybox-inner"); but without any results :/

Does anyone know where I am missing the point? Many thanks for all possible help.

Looking forward,

You have two options:

1) Create custom thumbnail module or edit existing one;

2) Use callbacks to do some manipulations, example:

$('[data-fancybox]').fancybox({
  onThumbsShow : function(instance, current) {
    instance.Thumbs.$grid.appendTo( instance.$refs.inner );
  }
});

Demo - https://codepen.io/anon/pen/yzJXRV?editors=1010

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM