How would i sequence the following code so one line runs after the previous ?
$('#jqNav li a').click(function(e){
if($(this).parent().is(".nav1")){ $('.landing .main .nav ul').css({ "background-position" : "0 -50px" });}
else if($(this).parent().is(".nav2")) { $('.landing .main .nav ul').css({ "background-position" : "0 -100px" });}
else if($(this).parent().is(".nav3")) { $('.landing .main .nav ul').css({ "background-position" : "0 -150px" });}
else if($(this).parent().is(".nav4")) { $('.landing .main .nav ul').css({ "background-position" : "0 -200px" });};
stopAnim = true;
$page = $(this).attr('href');
var $hashTag = $(this).attr('name');
window.location.hash = $hashTag;
loadData();
$(window).scrollTop(0);
e.preventDefault();
});
I would already bind the ajax call inside of the loadData block to a method on success. I have fabricated and tested (FF 5.0 & IE 9) the following code snippet and the success method is called (you need to create the ‘test.html’ file):
The only thing I noticed was that ‘e.preventDefault’ would not stop me from following the link so I changed that to ‘return false’.