YUI TabView Control Not Working
if you came across the YUI TabView Control you will find it not working!
Well i want to use it in one project so i spend like 5 minutes to check what’s the problem with it!!!!
and i discovered that it’s not working because of the Basic Markup:
<div id="demo" class="yui-navset yui-navset-top">
<ul class="yui-nav">
<li><a href="#tab1"><em>Tab One Label</em></a></li>
<li title="active" class="selected"><a href="#tab2"><em>Tab Two Label</em></a></li>
<li title="" class=""><a href="#tab3"><em>Tab Three Label</em></a></li>
</ul>
<div class="yui-content">
<div <strong>style="display: none;"</strong> id="tab1"><p>Tab One Content</p></div>
<div <strong>style="display: block;"</strong> id="tab2"><p>Tab Two Content</p></div>
<div <strong>style="display: none;"</strong> id="tab3"><p>Tab Three Content</p></div>
</div>
</div>
<ul class="yui-nav">
<li><a href="#tab1"><em>Tab One Label</em></a></li>
<li title="active" class="selected"><a href="#tab2"><em>Tab Two Label</em></a></li>
<li title="" class=""><a href="#tab3"><em>Tab Three Label</em></a></li>
</ul>
<div class="yui-content">
<div <strong>style="display: none;"</strong> id="tab1"><p>Tab One Content</p></div>
<div <strong>style="display: block;"</strong> id="tab2"><p>Tab Two Content</p></div>
<div <strong>style="display: none;"</strong> id="tab3"><p>Tab Three Content</p></div>
</div>
</div>
Here is the working version (if you didn’t notice you only have to remove the style inside tab contents):
<div id="demo" class="yui-navset yui-navset-top">
<ul class="yui-nav">
<li><a href="#tab1"><em>Tab One Label</em></a></li>
<li title="active" class="selected"><a href="#tab2"><em>Tab Two Label</em></a></li>
<li title="" class=""><a href="#tab3"><em>Tab Three Label</em></a></li>
</ul>
<div class="yui-content">
<div <strong>style=""</strong> id="tab1"><p>Tab One Content</p></div>
<div <strong>style=""</strong> id="tab2"><p>Tab Two Content</p></div>
<div <strong>style=""</strong> id="tab3"><p>Tab Three Content</p></div>
</div>
</div>
<ul class="yui-nav">
<li><a href="#tab1"><em>Tab One Label</em></a></li>
<li title="active" class="selected"><a href="#tab2"><em>Tab Two Label</em></a></li>
<li title="" class=""><a href="#tab3"><em>Tab Three Label</em></a></li>
</ul>
<div class="yui-content">
<div <strong>style=""</strong> id="tab1"><p>Tab One Content</p></div>
<div <strong>style=""</strong> id="tab2"><p>Tab Two Content</p></div>
<div <strong>style=""</strong> id="tab3"><p>Tab Three Content</p></div>
</div>
</div>
Now it’s going to work as you expect! Make sure you check The Working Version




Discussion
Comments are disallowed for this post.
Comments are closed.