开发者

jquery flash object show hide

i am trying to show/hide a flash object based on click of button, but the code is not working

//to hide

$('object').css({visibility: 'hidden'});

//to show

$('object').css({visibility开发者_运维知识库: 'visible'});

i dont want to use .show() and .hide() as they will also remove the area of flash content.


$('object')
.wrap('<div class="fl-wrapper">') // Wrap the flash object in a div.
.parent().css({'overflow':'hidden'}) // Set the wrapper to overflow hidden.
.children().css({'margin-left':-99999});  // Set flash object to be out of box.

Then to toggle it back, you can:

$('object').css('margin-left',0);

I only tested this in Firefox. For other browsers you may also need to set the wrapper div's height and width to be equal to the object's height and width.


From what I've seen, this is not possible (especially cross-browser). Even using hide/show doesn't work in IE6/7. The only solution I've seen work is to remove the object from the DOM / append it back to the DOM.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜