Ajaxed DIV隐藏和显示后,才DIV负荷揣负荷、Ajaxed、DIV

2023-09-11 01:35:30 作者:収敛惆怅

我有这个问题。我工作的一个jQuery ajaxed网站。我的主要内容股利在中间和顶部的导航。我需要AJAX的内容,因为我有闪光backgound,使闪光的视频就不会在每次页面加载后,从开始启动。我能做到这一点的唯一方法就是用这样的code:

I have this issue. I'm working on a jquery ajaxed site. I have the main content div in the middle and on top the navigation. I need to AJAX the content, because I have flash backgound so that the flash video won't start from beginning after every page load. The only way I was able to do this was with this sort of code:

$(document).ready(function(){


$.ajaxSetup ({  
         cache: false  
         }); 

//For loading
     var ajax_load = "<img src='img/load.gif' alt='loading...' /><p>";  

 //  Var
    var loadPage1 = "page1.html";

//  Load page
    $("#page1").click(function(){
            $("#content").hide(2000);
            $("#content").html(ajax_load).load(loadPage1);
            $("#content").show(2000);
});

所有其他方式获得的股利没有工作,因为没有就凑了ajaxed格(内容)工作插件等问题。

All other ways to get the div didn't work because there was issues on getting plugins etc. working in the ajaxed div (content).

所以...... everythig工作正常 - 但是,在div负载是从page1.html内容并显示,只有经过这样做是隐藏它,并显示它。因此,它加载的页面,然后进行效果我想。

So... everythig is working fine - but, the div loads it's content from page1.html and shows it and only after this does it hide it and show it. So it loads the page and then does the effects I want to.

我需要排队一些这方面怎么还是有什么合适的jquery的方式吗?我想延迟,停止等,但似乎无法来解决这一点。这是propably非常简单。

Do I need to queue this some how or what's the proper jquery way? I tried delay, stop etc.. but can't seem to solve this out. It's propably very simple.

感谢。

推荐答案

显示在负载回调处理程序的元素。 即:

Show the element in the load callback handler. i.e:

$("#page1").click(function(){             
    $("#content").hide();             
    $("#content").html(ajax_load).load(loadPage1, function(){
        $("#content").show(2000)
    });
});