我目前正在使用这个脚本来实现页面过渡淡入淡出:
$(document).ready(function() {
$(window).bind("unload", function() {});
$("body").css("display", "none");
$("body").hide();
$("body").fadeIn(2000);
$('a.fade1, a.fade2, a.fade3, a.fade4').click(function(event) {
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(700, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}
});
这个在内容已经在缓存中的情况下非常好用,但是当需要加载图像时,它会短暂地出现,然后被隐藏并淡入。
因此,我需要一种方法来隐藏内容,直到它完全加载,然后才让它淡入。
希望有人能帮助我,提前感谢。
display: none
,这样它就一直隐藏,直到jquery生效。 - Dave Becker