Search code examples
javascriptscrollto

ScrollTo strange behavior


I'm using ScrollTo plugin in my site, I also use requirejs to load my files.

require(['jquery','skrollr','boodstrap','scrollto'],function($,skrollr,b,scrolltoo){....

When i use code:

$("#about").ScrollTo();

all is working well, but if I use:

$.scrollTo("#about", 800, {easing:'elasout'});

its not working at all.

Also i try to add offset to scroll using:

$.extend($.scrollTo.defaults, {
  offset: 50,
  duration: 800
});

Also no results. Can any one explain me were is error ?


Solution

  • Documentation says in "window shorthand":

    You can use $.scrollTo(...) as a shorthand for $(window).scrollTo(...).

    So $.scrollTo("#about", 800, {easing:'elasout'}); is not the same as $("#about").ScrollTo(); (which btw, should be scrollTo).