mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
always scroll to the element regardless of its visibility for more ux consistency
This commit is contained in:
@@ -138,16 +138,11 @@ module.directive('scrollTo', [ '$timeout', function($timeout) {
|
||||
var elemTop = $(element).offset().top;
|
||||
var elemBottom = elemTop + $(element).height();
|
||||
|
||||
if ((elemTop > docTop) && (elemBottom < docBottom)) {
|
||||
// element is entirely visible
|
||||
return;
|
||||
} else {
|
||||
var offset = parseInt(attrs.scrollToOffset, 10);
|
||||
var scrollTop = $(element).offset().top + offset;
|
||||
$('html, body').animate({
|
||||
scrollTop : scrollTop
|
||||
}, 0);
|
||||
}
|
||||
var offset = parseInt(attrs.scrollToOffset, 10);
|
||||
var scrollTop = $(element).offset().top + offset;
|
||||
$('html, body').animate({
|
||||
scrollTop : scrollTop
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user