Chaim
Chaim

Reputation: 2149

Flash in hidden div, load only when div is shown

I have a flash file that is in a div that is hidden when the page is loaded with the css property display:none. The div with the flash content is then shown at a later stage through javascript.

When will the flash file load? Ideally, I only want it to load when the div is shown.

Upvotes: 0

Views: 1054

Answers (1)

Xavier
Xavier

Reputation: 8362

What i would do is load the flash file only if the div is visible, what you can also do is create a <noscript> tag around the flash file so when javascript is disabled it will still display.

if($(div).is(":visible")){

    $(this).load("flash.swf");

}

Upvotes: 4

Related Questions