mozilla

Template:Tabs

<pre class="script">
var tablist = "";

foreach(var t in $0) {
  tablist = tablist + "$('.htab').append($('#tab-" + t + "'));"
}
var theScript = "$(function() {" + json.emit(tablist) + 
"           var $items = $('.htab>ul>li');
            $items.click(function() {
                $items.removeClass('selected');
                $(this).addClass('selected');

                var index = $items.index($(this));
                $('.htab>div').hide().eq(index).show();
            }).eq(0).click();
        });";
<script type="text/javascript"><![CDATA[
(web.html(theScript));
]]></script>;
<div class="htab"><ul> var b = 0; foreach(var t in $0) { 	if (!b) { 		web.html('<li class="selected">' + t + '</li>'); 		b = 1; 	} else { 		web.html("<li>" + t + "</li>"); 	} } </ul></div>

%>
Search for pages that use Template:Tabs to see example use cases and how many pages use this macro.

Document Tags and Contributors

Tags: 
Contributors to this page: Sheppy, ethertank
Last updated by: ethertank,