javascript - How to scrollToElement using angular-scroll? -
i'm using angular scroll , once hit page fire function scroll id. i'm getting following error on code below:
typeerror: $document.scrolltoelement not function
inithelp(); function inithelp() { console.log('inithelp'); $document.scrolltoelement('#chart-help', 500).then(function() { console && console.log('you scrolled chart-help!'); }); }
the docs angular-scroll
.scrollto( element [, offset, [, duration [, easing ] ] ] ) alias of .scrolltoelement. .scrolltoelement( element [, offset, [, duration [, easing ] ] ] )
figured out:
var charthelp = angular.element(document.getelementbyid('chart-help')); $document.scrolltoelement(charthelp, 30, 500).then(function() { console && console.log('you scrolled chart-help!'); });
also docs, missing offset number: $document.scrolltoelement(someelement, offset, duration);
Comments
Post a Comment