Forum Moderators: open

Message Too Old, No Replies

Why is not working tabs system in YUI V3?

         

toplisek

1:00 pm on Mar 27, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have set UI and added application file. How to make working Tab system?
I'm new to YUI.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>

<script src="javascript/yui-min.js" charset="utf-8"></script>

</head>

<body>
<div id="demo"></div>
<script>
YUI().use('tabview', function(Y) {
var tabview = new Y.TabView({
children: [{
label: 'foo',
content: '<p>foo content</p>'
}, {
label: 'bar',
content: '<p>bar content</p>'
}, {
label: 'baz',
content: '<p>baz content</p>'
}]
});

tabview.render('#demo');
});
</script>
<div id="demo">
<ul>
<li><a href="#foo">foo</a></li>
<li><a href="#bar">bar</a></li>
<li><a href="#baz">baz</a></li>
</ul>
<div>
<div id="foo">foo content</div>
<div id="bar">bar content</div>
<div id="baz">baz content</div>
</div>
</div>


<!-- Basic UL -->
<!--<div id="demo">
<ul>
<li><a href="#foo">foo</a></li>
<li><a href="#bar">bar</a></li>
<li><a href="#baz">baz</a></li>
</ul>
<div>
<div id="foo">foo content</div>
<div id="bar">bar content</div>
<div id="baz">baz content</div>
</div>
</div>-->
</body>

</html>


Fotiman

1:00 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need to apply a class to the body element in order to "skin" it.

<body class="yui3-skin-sam">

toplisek

4:16 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Working.
1. Is there any way to do it outside body and how to do it?
2. Is there possibility to show DIV demo not within javascript as now works content within javascript.

Fotiman

6:15 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Working.

Great!

1. Is there any way to do it outside body and how to do it?

According to the Skinning TabView Widget [developer.yahoo.com] documentation, you can apply the skin "to some ancestor", but in my experience you might encounter problems if you don't chose the body element as the ancestor to apply it to. YMMV.

2. Is there possibility to show DIV demo not within javascript as now works content within javascript.

I'm not sure what you're asking. The examples [developer.yahoo.com] provide both a TabView from Existing Markup [developer.yahoo.com] and Dynamic TabView from JavaScript [developer.yahoo.com] example, if that's what you were wondering about.

toplisek

6:58 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks. You are right.