我正在尝试根据按钮的点击来显示/隐藏 flash 对象,但代码不起作用
//to hide<br/>
$('object').css({visibility: 'hidden'});<br/>
//to show<br/>
$('object').css({visibility: 'visible'});<br/>
我不想使用 .show() 和 .hide(),因为它们也会删除 Flash 内容区域。
最佳答案
$('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.
然后要将其切换回来,您可以:
$('object').css('margin-left',0);
我只在 Firefox 中测试过。对于其他浏览器,您可能还需要将包装器 div 的高度和宽度设置为等于对象的高度和宽度。
关于jquery flash 对象显示隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2693441/