From 01e7467c0b559203e9af38e682af2681ffa0aa46 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 1 Aug 2013 16:06:19 +0200 Subject: also scroll correctly to bottom in firefox --- js/app/directives/newsclickscroll.coffee | 9 +++++---- js/public/app.js | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/app/directives/newsclickscroll.coffee b/js/app/directives/newsclickscroll.coffee index 6194d5103..b7ca98757 100644 --- a/js/app/directives/newsclickscroll.coffee +++ b/js/app/directives/newsclickscroll.coffee @@ -26,13 +26,14 @@ angular.module('News').directive 'newsClickScroll', ['$timeout', ($timeout) -> elm.click -> scrollArea = $(options.scrollArea) direction = options.direction - if direction == 'top' - scrollPosition = 0 - else - scrollPosition = scrollArea[0].scrollHeight # do this to execute after rendering $timeout -> + if direction == 'top' + scrollPosition = 0 + else + scrollPosition = scrollArea.prop('scrollHeight') + scrollArea.scrollTop(scrollPosition) , 10 ] \ No newline at end of file diff --git a/js/public/app.js b/js/public/app.js index 79a30e549..7081004fb 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -327,15 +327,16 @@ License along with this library. If not, see . var options; options = scope.$eval(attr.newsClickScroll); return elm.click(function() { - var direction, scrollArea, scrollPosition; + var direction, scrollArea; scrollArea = $(options.scrollArea); direction = options.direction; - if (direction === 'top') { - scrollPosition = 0; - } else { - scrollPosition = scrollArea[0].scrollHeight; - } return $timeout(function() { + var scrollPosition; + if (direction === 'top') { + scrollPosition = 0; + } else { + scrollPosition = scrollArea.prop('scrollHeight'); + } return scrollArea.scrollTop(scrollPosition); }, 10); }); -- cgit v1.2.3