diff --git a/src/app/index.run.js b/src/app/index.run.js index 3258d04..5986da8 100644 --- a/src/app/index.run.js +++ b/src/app/index.run.js @@ -11,6 +11,7 @@ .run(runHistory) .run(runPath) .run(runSocialAuth) + .run(runScroll) .run(runUtils) .run(runBlock); @@ -214,6 +215,18 @@ } /** @ngInject */ + function runScroll($rootScope, jQuery) { + $rootScope.$on('change-selectedCategory', function(){ + var $resultEl = jQuery('.section--articles .header'); + + if($resultEl && $resultEl.length > 0){ + $rootScope.scrollTo($resultEl); + // angular.element('body').animate({scrollTop: $resultEl.offset().top}, 'fast'); + } + }); + } + + /** @ngInject */ function runUtils($rootScope) { $rootScope.stripHtml = function(text) { return String(text).replace(/<[^>]+>/gm, ''); -- libgit2 0.21.2