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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -