Home › Forums › JavaScript › How would I get nav links to show an active state when scrolling content for a Responsive website? › Re: How would I get nav links to show an active state when scrolling content for a Responsive website?
/* You get a Type Error on the first line of your script. */
jQuery(document).ready(function($){
$(‘header h1 a’).smoothScroll({
speed: 600
});
…
Ready function should be call this way :
$(document).ready(function() {
Your document ready code here
});
or
$(function() {
your document ready code here.
});
Actually your using it like you are using the noConflict() option of jQuery without using it. When noConflict() is use the syntax “jQuery(document).ready(function($) {…})” is use but the global jQuery variable is passed as argument to the ready function($) and then you can use the $ inside your function. But you are not using any other library in your sample code so take the basic syntax of $(function() { /* YOUR FUNCTION CODE HERE */}); and it should work.
Remember, if your not using any jQuery CONFLICTING library, always use $ instead of jQuery.
Hope this help.