diff --git a/panels/scrollbar/script.js b/panels/scrollbar/script.js index b473444d69e918483a68a50d40d3574d8765a359..960d01301b37044a40182d41408f7866a2a068f4 100755 --- a/panels/scrollbar/script.js +++ b/panels/scrollbar/script.js @@ -11,7 +11,8 @@ this.loaded = function(panel, config) { font = "vrr", baseline = 0.7, textID = -1, - amount = 5, + amount = 2, + ticklimit = 10, delay = 2, width = 0, height = 0, @@ -19,7 +20,8 @@ this.loaded = function(panel, config) { marquee = null, mctx = null, strings = [], - texts = []; + texts = [] + ; init = function() { marquee = $(panel).find('[data-marquee]')[0]; @@ -46,7 +48,13 @@ this.loaded = function(panel, config) { left = left * width / oldWidth; } + var lastRenderTime = 0; render = function(delta) { + if (delta-lastRenderTime <= ticklimit) { + window.requestAnimationFrame(render); + return; + } + lastRenderTime=delta; if (left > -texts[textID].width) { left = left - (amount > 0 ? amount : 1);