jquery.jscrollpane.js滾動速度設置


首先找到插件里面的這個函數,改變成下面的樣子:

function initMousewheel()
            {
                container.unbind(mwEvent).bind(
                    mwEvent,
                    function (event, delta, deltaX, deltaY) {

                        if (!horizontalDragPosition) horizontalDragPosition = 0;
                        if (!verticalDragPosition) verticalDragPosition = 0;

                        var dX = horizontalDragPosition, dY = verticalDragPosition, factor = settings.mouseWheelSpeed || event.deltaFactor;
                        jsp.scrollBy(deltaX * factor, -deltaY * factor, false);
                        // return true if there was no movement so rest of screen can scroll
                        return dX == horizontalDragPosition && dY == verticalDragPosition;
                    }
                );
            }

插件原來的是這樣子的;

function initMousewheel()
            {
                container.unbind(mwEvent).bind(
                    mwEvent,
                    function (event, delta, deltaX, deltaY) {

                        if (!horizontalDragPosition) horizontalDragPosition = 0;
                        if (!verticalDragPosition) verticalDragPosition = 0;

                        var dX = horizontalDragPosition, dY = verticalDragPosition, factor = event.deltaFactor || settings.mouseWheelSpeed;
                        jsp.scrollBy(deltaX * factor, -deltaY * factor, false);
                        // return true if there was no movement so rest of screen can scroll
                        return dX == horizontalDragPosition && dY == verticalDragPosition;
                    }
                );
            }

必須要把標紅的地方改過來;

再到js里面設置屬性:為json格式。

如:

$('.p5_content_wrap').jScrollPane({"mouseWheelSpeed":50});

 如果需要滾動條自適應的話,即父容器尺寸改變的情況下滾動條也做出相應的改變:

$('.company-pop-wrap ul').jScrollPane({"mouseWheelSpeed": 50, autoReinitialise: true});

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM