Fancybox 3: Disable zoom when image is clicked
Asked Answered
P

2

5

I have set up a simple image slider using the Fancybox 3 plugin (http://fancyapps.com/fancybox/3/docs/) within the Kirby CMS (https://getkirby.com/). The only thing I'm not able to work out, is how to stop the slider from zooming into an image when the image is clicked on while the slider is open.

Can someone give me a hand with this?

I tried including clickSlide : 'close', in the options for the slider, but it did not work.

Here are the options I have set up for the slider globally on my site:

  <!-- Setting fancybox-options GLOBALLY -->

    <script type="text/javascript">

       $("[data-fancybox]").fancybox({

         thumbs          : false,

         hash            : false,

         loop            : true,

         keyboard        : true,

         toolbar         : false,

         animationEffect : false,

         arrows          : true,

       });

    </script>

  <!-- /////////////////////// -->
Pouf answered 11/8, 2017 at 15:18 Comment(0)
F
8

Just use clickContent option:

$("[data-fancybox]").fancybox({
  thumbs          : false,
  hash            : false,
  loop            : true,
  keyboard        : true,
  toolbar         : false,
  animationEffect : false,
  arrows          : true,
  clickContent    : false
});

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

clickSlide option is used for clicks outside content, but inside the slide. And since parent of the slide can be resized (like in this example - https://codepen.io/fancyapps/pen/ZKqaKO), clickOutside option is when clicked outside the slide.

Fideicommissum answered 11/8, 2017 at 17:2 Comment(0)
S
1

To disable click to scroll and remove zoom button from the toolbar:

$('[data-fancybox]').fancybox({
  clickContent: 'close',
  buttons: ['close']
})
Snubnosed answered 19/2, 2020 at 16:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.