In one of our webapps we have two panels, each of which contains flash animation. Only one of the panels is displayed, and the other is hidden. Initially, we used jquery.hide () and .show () on panels, but with Chrome (21.0) every time the visibility of one panel changed from hidden to block flash animations restarted inside.
We tried various solutions offered on the Web, but only one works well: avoid changing the display or visibility css properties and hide the panels, changing the absolute position instead.
Something like that:
<div class="panelContainer"> <div id="panel1"> <object>...flash code here...</object> </div> <div id="panel2" class="active"> <object>...flash code here...</object> </div> </div>
.panelContainer { position: relative; } .panelContainer > div { position: absolute; top: 0; left: -3999px; } .panelContainer > div.active { left: 0; }
function showPanel(id) { $('#panelContainer > div.active').removeClass('active'); $('#'+id).addClass('active'); } showPanel('panel1');
Strange, but true, we only have this problem with Chrome, while IE9 and FireFox 15 work with .hide () and .show (). Hope this helps.
Znheb source share