I have this code:
$(document).ready(function(){
$(".links a").click(function(e){
var toLoad = "products.html #" + this.id;
$('#block').fadeTo('fast',0,loadContent);
function loadContent() {
$('#block').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#block').fadeTo('slow',100);
}
e.preventDefault();
});
});
The idea is:
- click on a link to trigger (check!)
- the "block" div fades to 0 (check!)
- the content is switched out (check!)
- the "block" div fades back 100 (whoops!)
The behavior I see is that the div fades out, then pops back with new content as soon as the fadeOut is completed.
Any thoughts on this?