0
所以我有一个.fadeIn()回调的图像.load设置,工作得很好。问题是,如果我在相同的图像上连续两次触发.load,它不会到达回调!jQuery:.load图片,然后fadeIn()失败,当点击两次!
这里的代码片段:
$('#thumbs a').click(function() {
imageSrc = $(this).attr('href').substring(1)+'.jpg'; // grab src, remove hash, add jpeg extension
$('#viewer img').fadeOut('fast', function() { // fade old image out fast, wait until finished before changing src
$('#viewer img').attr('src', (mediumPath+imageSrc)); // change src to new image
$('#viewer a').attr('href', imageSrc);
});
$('#viewer img').load(function(){ // once image is loaded, fade the img back in
$('#viewer img').fadeIn('slow');
});
return false;
});
而且你可以尝试在我的网站(在建)here。只需点击左侧的缩略图两次,loader.gif就不会消失,即不会进入.fadeIn()。
注意:(?)我相信这仅仅是影响WebKit浏览器
感谢您的关注,我很感激。我想我不应该在这个网站上指点人,而我正在积极研究这个网站,呵呵。我现在将在本地副本上工作,因为它代表了已经存在的繁琐页面。 至于返回false,我意识到另一种方法,我粘贴了那些内容,因为我计划使用jQuery BBQ进行散列导航,但是希望在构建其他代码时摆脱它们。 – Benji 2010-07-26 08:14:48