« 上一个 | 下一个 »

确定网站的整体结构,包括主页和内部页面的关系、页面层次和导航方式等。设计时需要考虑到用户的使用习惯和导航体验,同时还需要保证网站的搜索引擎友好。
根据页面的内容和层次,设计页面的布局。页面布局的设计应该尽可能地简洁明了,避免过多的视觉干扰,使用户能够快速地找到需要的信息。

Nesting

You can nest tab interfaces easily but remember to set different tabclass for nested interface:

var tabber2 = new Yetii({
id: 'demo-nested',
tabclass: 'tab-nested'
});

Tab 1

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Tab 2

It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Next/Previous

Yetii also contains methods allowing to paginate between tabs using next/previous buttons:

var tabber1 = new Yetii({
id: 'demo'
});

<a href="javascript:tabber1.previous()">previous</a> |
<a href="javascript:tabber1.next()">next</a>

Basic usage

  1. Download yetii.js and include it in your webpage within <head> section. Alternatively you can put Yetii code inside your common.js file.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <script type="text/javascript" src="yetii.js"></script>
    </head>
  2. Prepare the markup:

    <body>
    
    <div id="tab-container-1">
    
        <ul id="tab-container-1-nav">
        <li><a href="#tab1">tab 1</a></li>
        <li><a href="#tab2">tab 2</a></li>
        </ul>
    
        <div class="tab" id="tab1">
        <h2>tab 1</h2>
        <p>Lorem Ipsum is simply dummy text
        of the printing and typesetting industry.</p>
        </div>
        
        <div class="tab" id="tab2">
        <h2>tab 2</h2>
        <p>It was popularised in the 1960s with 
        the release of Letraset sheets.</p>
        </div>
        
    </div>
    
    </body>

    All tabs should have correct class applied (tab in above case but this is configurable). Also all tabs should be wrapped with a container with id specified (tab-container-1 in above case). Unordered list inside a wrapper (which represents tabs buttons) should have an id constructed in following convention: wrapper-id + '-nav' (tab-container-1-nav in above case).

    Note that Yetii will apply active class to selected tab link dynamically:

    <ul id="tab-container-1-nav">
    <li class="activeli"><a class="active" href="#tab1">tab 1</a></li>
    <li><a href="#tab2">tab 2</a></li>
    </ul>

    By convention Yetii will also apply activeli class to list item holding selected tab link. All classes set in markup for list items and links are preserved when adding active classes. If you change default active class name from active to something else (i.e. selected), list item will be marked with selectedli class.

  3. Initialize Yetii object:

    <body>
    
    <div id="tab-container-1">
    
        <ul id="tab-container-1-nav">
        <li><a href="#tab1">tab 1</a></li>
        <li><a href="#tab2">tab 2</a></li>
        </ul>
    
        <div class="tab" id="tab1">
        <h2>tab 1</h2>
        <p>Lorem Ipsum is simply dummy text
        of the printing and typesetting industry.</p>
        </div>
        
        <div class="tab" id="tab2">
        <h2>tab 2</h2>
        <p>It was popularised in the 1960s with 
        the release of Letraset sheets.</p>
        </div>
        
    </div>
    
    <script type="text/javascript">
    var tabber1 = new Yetii({
    id: 'tab-container-1'
    });
    </script>
    
    </body>

Advanced usage