Javascript Div内容淡入淡出
我很抱歉,如果这个问题之前已经发布过一次,我是jquery的noob,但我似乎有一部分在工作 我的代码部分工作,但当你去krissales.com,它会加载页面两次,如果你明白我的意思。我只希望它加载一次,在淡入时加载一次,在淡出时加载一次,但是它会加载两次 再次,我道歉,如果这已经被张贴。非常感谢你抽出时间。多谢各位 这是我的代码:Javascript Div内容淡入淡出,javascript,jquery,Javascript,Jquery,我很抱歉,如果这个问题之前已经发布过一次,我是jquery的noob,但我似乎有一部分在工作 我的代码部分工作,但当你去krissales.com,它会加载页面两次,如果你明白我的意思。我只希望它加载一次,在淡入时加载一次,在淡出时加载一次,但是它会加载两次 再次,我道歉,如果这已经被张贴。非常感谢你抽出时间。多谢各位 这是我的代码: function page_load($href) { if($href != undefined && $href.substring(0,
function page_load($href) {
if($href != undefined && $href.substring(0, 2) == '#/') {
// replace body the #content with loaded html
$('#content').load($href.substring(2));
$('#content').fadeOut('slow', function() {
$('#content').fadeIn('slow');
});
}
}
完整核心位于:
您正在进行缓慢的淡出,然后在回调中淡出。您可以尝试在load()方法回调中隐藏#内容,然后将fadeIn()链接为最终方法。例如:
function page_load($href) {
if($href != undefined && $href.substring(0, 2) == '#/') {
// replace body the #content with loaded html
$('#content').load($href.substring(2), function () {
$('#content').hide().fadeIn('slow');
});
}
}
您正在进行缓慢的淡出,然后在回调中淡出。您可以尝试在load()方法回调中隐藏#内容,然后将fadeIn()链接为最终方法。例如:
function page_load($href) {
if($href != undefined && $href.substring(0, 2) == '#/') {
// replace body the #content with loaded html
$('#content').load($href.substring(2), function () {
$('#content').hide().fadeIn('slow');
});
}
}
你确定页面加载了两次吗?不过在我的机器上运行得很好!你确定页面加载了两次吗?不过在我的机器上运行得很好!啊,所以这只是一个。隐藏,该死。谢谢你,伙计。我很感激你。啊,所以这只是一个。隐藏,该死。谢谢你,伙计。谢谢你。