开发者

Jquery 23 Second Delay change div

I implemented my Cub3r like this

<script type="text/javascript">
            var flashvars = {};
            flashvars.xml = "config.xml";
            flashvars.font = "font.swf";
            var attributes = {};
            attributes.wmode = "transparent";
            attributes.id = "slider";
            swfobject.embedSWF("cu3er.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes);
    </script>

And I wish to change the cu3er.swf to a.swf i have made after 23 seconds using jQuery. How could I do this ?

<sc开发者_运维技巧ript type="text/javascript">
            swfobject.embedSWF("printmachine.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes);
</script>

Thanks


It is not really jQuery specific, what you need is to use setTimeout

<script type="text/javascript">
// your code ...
swfobject.embedSWF("cu3er.swf", "cu3er-container", /*...*/);

setTimeout(function() {
  jQuery('#cu3er-container').empty(); // in case swfobject doesn't clean the div before inserting, might not be needed
  swfobject.embedSWF("printmachine.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes);
}, 23000); // the number is in millisecond, so 23 * 1000 for 23 seconds
</script>


Try this javascript code

var flashvars = {};
flashvars.xml = "config.xml";
flashvars.font = "font.swf";
var attributes = {};
attributes.wmode = "transparent";
attributes.id = "slider";
swfobject.embedSWF("cu3er.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes);

setTimeout(function ()
{
   swfobject.embedSWF("a.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes);
}, 23000); 


Try the .delay() in jquery so you can launch the substitution after a defined amount of time http://api.jquery.com/delay/


in jQuery 1.4+ onwards there is delay function try using that

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜