I am new to javascript and I have been playing around with prevent default command for ajax pagination and I have the following code:
$('.pagination').click(function(e){
e.preventDefault();
// fade out current content
$('.results').css("opacity", "0.5");
// load new content
// ....
// unfade
$('.results').css("opacity", "1");
// go back up to top of the page
$('html,body').scrollTop(0);
});
However, it doesn't seem to be working, it links to a new page instead of executing the fade in and out and bringing it back to the top of the page. I have checked the code for the opacity and scoll and it seems to be right so where am I going wrong here?
SyntaxError: illegal character @ http://fiddle.jshell.net/_display/:27(#isn't a JavaScript comment character.) Your console (Ctrl+Kin FF,Ctrl+Jin Chrome,F12in IE) should be your first stop for diagnosing errors.//and proceed with your analysis