我希望我的标题是看不见的,然后动画到地方时,页面加载。
目前,我有一个从一个淡出/淡入的登录页面的过渡,在此过渡发生之前,页眉不应该开始动画到位。此外,只有当我来自我的登录页面时,这种转换才会发生。
你知道该怎么做吗?
下面是我的淡入/淡出脚本:
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn(2000);
$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(1000, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}
});发布于 2012-12-15 05:35:34
在链接位置的末尾添加一个标签怎么样?就像#dashboard之类的。然后,当页面加载时,您可以检查hashtag是否存在。如果是这样,那么动画的主体和添加淡入在头部的回调的主体淡入。
就像这样
$(document).ready(function() {
if(window.location.hash)
{
$('body').hide();
//move the header to the top
$('#header').css('top', -50);
$('body').fadeIn(2000, function(){
$('#header').animate({ top: '+=50', }, 2000, function() {
// Animation complete.
});
});
}
else
{
$("body").hide();
$("body").fadeIn(2000);
$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href + '#dashboard';
$("body").fadeOut(1000, redirectPage);
});
}
});
function redirectPage() {
window.location = linkLocation;
}https://stackoverflow.com/questions/13886287
复制相似问题