最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable swiping fancybox slides by mousemove - Stack Overflow

programmeradmin2浏览0评论

I'm using fancybox 3. I need to turn off swiping fancybox slides by mousemove. I would like to leave only control buttons next\prev. How can I do that? Thanks.

I'm using fancybox 3. I need to turn off swiping fancybox slides by mousemove. I would like to leave only control buttons next\prev. How can I do that? Thanks.

Share Improve this question asked Aug 7, 2017 at 18:02 Dmitry B.Dmitry B. 4261 gold badge4 silver badges11 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 13

So, the full answer will be:

Using data-options attribute

<a data-options='{"touch" : false}' data-fancybox data-src="#myElement" href="javascript:;">Click me</a>

Or when initializing fancybox

$('selector').fancybox({
    touch: false
});

From @Janis answer here: https://github.com/fancyapps/fancybox/issues/1277

Simply set touch:false to disable touch events.

The previous answer did not work for me on Fancybox 3.5.*. I had to move the touch option to inside the opts object, like as follows:

$.fancybox.open({
    src: yoursource,
    opts: {
        touch: false
    }
});
发布评论

评论列表(0)

  1. 暂无评论