Show jQuery

I'm trying to show / hide a Flash object based on a button click, but the code doesn't work. //to hide
$('object').css({visibility: 'hidden'});
//to show
$('object').css({visibility: 'visible'});


I don't want to use .show () and .hide () as they also delete the Flash content area.

+2


a source to share


2 answers


$('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 switch it, you can:



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

      

I've only tested this in Firefox. For other browsers, you may also need to set the width and width of the wrapper to the same height and width of the object.

+1


a source


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 is to remove the object from the DOM / add it back to the DOM.



0


a source







All Articles