I'm a front-end developer with an interest in client-side development through the use of HTML, CSS & JavaScript. I'm an evangelist of HTML5, CSS3, jQuery, standardization & open-source. I don't design the sites you use, I make them work.
When I click on the anchor, it does a normal jump: ie. toScroll is not working.
I have checked all of the javascript code and it all outputs the correct value. The only issue is with the line:
$.scrollTo(toTitle, {duration: 800, axis:"y"});
.. which it says is not defined.
I have checked and jQueryScrollTo.js is being loaded, as it appears in the header. (I am also using Drupal 6 so added the js in the my_theme.info file)
I have used several jQuery scripèts before with success so I am a little confused as to why I cannot get this one to work.
Hi Cory, great tutorial! Well documented and very clear.
BUT .. I am having an issue:
I want to implement just the functionality up to Step 8 (just a simple scrollTo).
My markup is equivalent to the example you use:
My Index (your "Questions") looks like this:
My Sub-titles (your "Answers") looks like this:
My javascript file looks like this:
$(function() { $("#index > li").click(function() { var fromIndex = $(this).attr("id"); var toTitle = "#" + fromIndex.replace("index","sub"); $.scrollTo(toTitle, {duration: 800, axis:"y"}); }); });When I click on the anchor, it does a normal jump: ie. toScroll is not working.
I have checked all of the javascript code and it all outputs the correct value. The only issue is with the line:
$.scrollTo(toTitle, {duration: 800, axis:"y"});.. which it says is not defined.
I have checked and jQueryScrollTo.js is being loaded, as it appears in the header. (I am also using Drupal 6 so added the js in the my_theme.info file)
I have used several jQuery scripèts before with success so I am a little confused as to why I cannot get this one to work.
Any ideas?