speed up scrolling on android

This commit is contained in:
Sam 2013-08-20 10:35:02 +10:00
parent 58b7df5480
commit 341a28402d
1 changed files with 12 additions and 3 deletions

View File

@ -25,10 +25,19 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
}.observes('controller.streamPercentage'),
updateProgressBar: function() {
var $topicProgress = $('#topic-progress');
if (!$topicProgress.length) return;
var $topicProgress = this.topicProgress;
var totalWidth = $topicProgress.width();
// cache lookup
if (!$topicProgress) {
$topicProgress = $('#topic-progress');
if (!$topicProgress.length) {
return;
}
this.topicProgress = $topicProgress;
}
// speeds up stuff, bypass jquery slowness and extra checks
var totalWidth = $topicProgress[0].offsetWidth;
var progressWidth = this.get('controller.streamPercentage') * totalWidth;
$topicProgress.find('.bg')