login/register

Snip!t from collection of Alan Dix

see all channels for Alan Dix

Snip
summary

Why does...
[edit]
...my slider, Google Map, sIFR etc. not work when placed ...
Any component that requires some dimensional computation ...
... }

UI/API/1.7.2/Tabs - jQuery JavaScript Library
http://docs.jquery.com/UI/Tabs#...retrieve_the_index_of_the_currently_selecte...

Categories

/Channels/techie/web development

[ go to category ]

For Snip

loading snip actions ...

For Page

loading url actions ...

Why does...

...my slider, Google Map, sIFR etc. not work when placed in a hidden (inactive) tab?

Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via display: none so that any elements inside won't report their actual width and height (0 in most browsers).

There's an easy workaround. Use the off-left technique for hiding inactive tab panels. E.g. in your style sheet replace the rule for the class selector ".ui-tabs .ui-tabs-hide" with

.ui-tabs .ui-tabs-hide {
    position: absolute;
    left: -10000px;
}

HTML

<h2>Why does...</h2> <div class="editsection" style="float: right; margin-left: 5px;">[<a href="/action/edit/Template:UIAPIPlugin?section=13" title="Template:UIAPIPlugin">edit</a>]</div><a name="...my_slider.2C_Google_Map.2C_sIFR_etc._not_work_when_placed_in_a_hidden_.28inactive.29_tab.3F"></a><h3>...my slider, Google Map, sIFR etc. not work when placed in a hidden (inactive) tab?</h3> <p>Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via <code>display: none</code> so that any elements inside won't report their actual width and height (0 in most browsers). </p><p>There's an easy workaround. Use the <em>off-left technique</em> for hiding inactive tab panels. E.g. in your style sheet replace the rule for the class selector ".ui-tabs .ui-tabs-hide" with </p> <pre>.ui-tabs .ui-tabs-hide { position: absolute; left: -10000px; }</pre> <p></p>