+ 1
javascript file not working in django Why?
when i see error in console -- >Uncaught SyntaxError: Unexpected token ';' why? $(document).ready(function() { $("ul li > a").click(function() { $("ul li > a").removeAttr("class"); $(this).addClass("home"); } ); $("ul li a").click(function() { var e=$(this.hash); $("body, html").animate( { scrollTop: e.offset().top; } , 700); return false; } ); $(window).scroll(function() { if($(this).scrollTop()>500) { $(".top").fadeIn(); } else { $(".top").fadeOut(); } }); $(".top").click(function() { $("body, html").animate( { scrollTop: 0; } , 500); return false; } ); })
4 Antworten
+ 2
those two scrollTop statements shouldn't be ended with ; because the animate function arguments should be an object, you can end with, or no ending punctuation.
animate({
//not to end with ; here
})
0
@Mirielle The code from which I copied worked there But not with me
0
@gordno scrollTop: e.offset().top this?