From 42927dc7e9b89d6b651cb72bad49d62796db1ac0 Mon Sep 17 00:00:00 2001 From: mrdrogdrog <tilman.vatteroth@udo.edu> Date: Fri, 3 Jul 2015 01:01:02 +0200 Subject: [PATCH] =?UTF-8?q?ticklimit=20f=C3=BCr=20scrollgeschwindigkeit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- panels/scrollbar/script.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/panels/scrollbar/script.js b/panels/scrollbar/script.js index b473444..960d013 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); -- GitLab