question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent image Zoom in Desktop Mod by click event

See original GitHub issue

Hi, i have following code to select next picture on click.


       gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
       gallery.init();

        gallery.listen('unbindEvents', function() { 
          gallery.framework.bind( gallery.scrollWrap, 'pswpTap', nextOnClick,true)
        });

    gallery.framework.bind( gallery.scrollWrap, 'pswpTap', nextOnClick );

    function nextOnClick(e) {
              if (e.detail.pointerType == 'mouse' && e.detail.target.className == 'pswp__img') {
                  if (gallery.getCurrentIndex() == gallery.items.length-1 ) {
                     gallery.close();
                  } else {
                      gallery.next();
                  } 
                  return false;     
              }

     }

it works, but if i set

   options.showAnimationDuration = 333;

for opening animation. By clicking the image is zoomed and going to next picture.

Is it possible to unbind image zoom on click without modifying the library?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dimsemenovcommented, Feb 6, 2015
gallery.toggleDesktopZoom = function() {};

… will destroy function that toggles desktop zoom. You can do the same thing with any other public function, e.g. gallery.ui.onGlobalTap = function() { alert('tap or click'); }.

Don’t be afraid to modify default UI, it’s created as a separate file and just via public methods, so developers could edit it.

0reactions
shchukincommented, Apr 10, 2016

clickToCloseNonZoomable: false @dimsemenov many thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable double-tap "zoom" option in browser on touch devices
Simple prevent the default behavior of click , dblclick or touchend events will disable the zoom ...
Read more >
I want to disable zoom in and zoom out feature in window 10
Click Pinch Zoom from the left pane, then uncheck the Enable Pinch Zoom box. Click the Apply button, then OK. You may also...
Read more >
How can i disable image zooming and remove the zoom icon ...
In your theme.liquid file, find the </body> (press CTRL + F or command ... But is there a way to prevent product zoom,...
Read more >
How to disable zoom on a mobile web page using CSS?
To disable the zooming option with the multi-touch gesture we can use surefox browser but still, a user can zoom in or out...
Read more >
Managing advanced screen sharing settings - Zoom Support
Sign in to the Zoom desktop client. Click your profile picture, then click Settings. Click the Share Screen share-screen-button__1_.png tab.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found