• Resolved dk2k2014

    (@dk2k2014)


    Hi guys,
    when user gets into image view, is it possible to call the previous and the next images using mouse scrolling? I mean integration with Easy FancyBox or a similar javascript library.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support weblizar_support

    (@weblizar_support)

    Hi dk2k2014,

    – Yes, it is possible and we will update this feature in next release asap.

    Thanks.

    Thread Starter dk2k2014

    (@dk2k2014)

    Not fixed in the new version 1.7.1 – in the image view mode scrolling moves the position on the page and doesn’t switch to the next or to the previous image

    Thread Starter dk2k2014

    (@dk2k2014)

    Guys, I’ve composed a fix and can provide a patch. Will try posting here, but indentation will break most likely. Contact me via dk2k@mail.ru if you want. Fix can be tested here

    — D:/user/Documents/responsive-gallery-with-lightbox/lightbox/swipebox/jquery.swipebox.js Sat Oct 27 11:30:24 2018
    +++ D:/user/Documents/jquery.swipebox.js Mon Oct 29 23:05:23 2018
    @@ -52,6 +54,20 @@
    return ui;
    }

    + // This function checks if the specified event is supported by the browser.
    + // Source: https://perfectionkills.com/detecting-event-support-without-browser-sniffing/
    + function isEventSupported(eventName) {
    + var el = document.createElement(‘div’);
    + eventName = ‘on’ + eventName;
    + var isSupported = (eventName in el);
    + if (!isSupported) {
    + el.setAttribute(eventName, ‘return;’);
    + isSupported = typeof el[eventName] == ‘function’;
    + }
    + el = null;
    + return isSupported;
    + }
    +
    plugin.init = function() {

    plugin.settings = $.extend( {}, defaults, options );
    @@ -207,6 +223,7 @@

    // Devices can have both touch and keyboard input so always allow key events
    $this.keyboard();
    + $this.mouse();

    $this.animBars();
    $this.resize();
    @@ -499,6 +516,34 @@
    },

    /**
    + * Mouse navigation
    + */
    + mouse : function () {
    + var wheelEvent = isEventSupported(‘mousewheel’) ? ‘mousewheel’ : ‘wheel’;
    + var $this = this;
    + $( window ).bind( wheelEvent, function( event ) {
    + event.preventDefault();
    + //event.stopPropagation();
    +
    + var oEvent = event.originalEvent;
    + var delta = oEvent.deltaY || oEvent.wheelDelta;
    +
    + // deltaY for wheel event
    + // wheelData for mousewheel event
    +
    + console.log(delta);
    + if (delta > 0) {
    + // Scrolled up
    + $this.getNext();
    + } else if (delta < 0) {
    + // Scrolled down
    + $this.getPrev();
    + }
    +
    + } );
    + },
    +
    + /**
    * Navigation events : go to next slide, go to prevous slide and close
    */
    actions : function () {
    @@ -759,6 +804,9 @@
    */
    destroy : function () {
    $( window ).unbind( ‘keyup’ );
    + // need to check which event to unbind the same way as having binded it
    + var wheelEvent = isEventSupported(‘mousewheel’) ? ‘mousewheel’ : ‘wheel’;
    + $( window ).unbind( wheelEvent );
    $( ‘body’ ).unbind( ‘touchstart’ );
    $( ‘body’ ).unbind( ‘touchmove’ );
    $( ‘body’ ).unbind( ‘touchend’ );

    Plugin Support weblizar_support

    (@weblizar_support)

    Hello dk2k2014,

    Thank you for this update. We will try to apply in our plugin ASAP.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is it possible to handle mouse scroll up and down’ is closed to new replies.