$("#listPanels a").live("click",function(e){
e.preventDefault();
can_changePn = false;
var tt = $(this).attr("href");
var pos = $(tt).offset().top;
var ctop = $('#contentPanel').scrollTop();
alert(tt+" : "+pos+" : "+ctop);
$('#contentPanel').animate({
scrollTop: (ctop+pos-50)},
500,function(){
can_changePn = true;
});
return false;
});
I use the above code to scroll to a div and it does work well in all browsers, however in IE7, it seems the code cannot get past $(tt).offset().top;, I have no clue as to what the problem might be, I did also try to use position instead of offset though, and the result is the same, if I try to alert that line, the alert doesn’t even open. Any ideas?
You are requesting the offset of an attribute now. I think you want to change this:
to this: