2012-12-11 193 views
0

我正在爲某個網站修改某個網站的html5/jQuery視頻播放器。到目前爲止,一切進展順利。我有一個小問題,播放列表的滾動速度非常緩慢,這裏是代碼;提高滾動速度 - jQuery

/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 
* Licensed under the MIT License (LICENSE.txt). 
* 
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 
* Thanks to: Seamus Leahy for adding deltaX and deltaY 
* 
* Version: 3.0.6 
* 
* Requires: 1.2.2+ 
*/ 
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery) 

您可以在這裏查看視頻播放器; http://design.jarethmusic.com/

正如您明顯看到的那樣,播放列表的滾動速度非常緩慢,任何排序的想法都是完美的。

問候 約翰

+0

似乎所有鼠標滾輪的增量(鼠標的速度)是由120 劃分建立一個新的稱爲速度的變量並將其設置爲10或更小。然後改變任何速度在120到你的新變量,嘗試並返回一條評論 – ntgCleaner

+0

這不是我的代碼。我不是很瞭解jQuery tbh –

+0

試試這個 - 它說「/ 120」的地方會說「/ 10」。幾乎在任何文本編輯器中,您都可以「查找並替換」所有文件。我會建議做一個臨時解決方案來查找是否有效。 – ntgCleaner

回答

1

嘗試用這種替代代碼:

/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 
* Licensed under the MIT License (LICENSE.txt). 
* 
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 
* Thanks to: Seamus Leahy for adding deltaX and deltaY 
* 
* Version: 3.0.6 
* 
* Requires: 1.2.2+ 
*/ 
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/10),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/10),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/10),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)