Smooth horizontal scroll bound to mousewheel

后端 未结 7 609
星月不相逢
星月不相逢 2020-12-29 12:08

Here is a working example of horizontal scroll with mousewheel, but it does not scroll smoothly. By smoothly I mean like ordinary vertical scroll in Firefox or Opera.

<
7条回答
  •  礼貌的吻别
    2020-12-29 12:50

    I'm just going to leave this here.

    http://jsfiddle.net/Dw4Aj/19/

    jQuery(document).ready(function($) {
    $("html, body").mousewheel(function(e, delta) { 
        $('html, body').stop().animate({scrollLeft: '-='+(150*delta)+'px' }, 200, 'easeOutQuint');
        e.preventDefault();
    });
    
    });
    

提交回复
热议问题