Code Monkey home page Code Monkey logo

tabmenu's Introduction

tabmenu - simple tabs in html

tabmenu is a tiny jquery plugin that will turn a bit of html markup into tabs. It only takes care of the hide/show business, and even this is done solely through css classes so you retain full control over the look.

Markup example

tabmenu works with the following markup :

<div id="tabcontainer">
	<nav >
		<ul>
			<li>
				<a href="#tab1" class="ux-tab-label">
					tab 1
				</a>
			</li>
			<li>
				<a href="#tab2" class="ux-tab-label">
					tab 2
				</a>
			</li>
		</ul>
	</nav>
	<div id="tab1" class="ux-tab">
		Content of first tab
	</div>
	<div id="tab2" class="ux-tab">
		Content of second tab
	</div>
</div>

You can use whatever tags you like, except for the tab labels which have to be links (ie. a element).

Usage

$(function(){
	$('#tabcontainer').tabmenu();
});

Simple.

css classes

tabmenu doesn't directly hide/show anything, it just add and removes classes.

Tab that should be hidden get the class hidden, and the a tag that corresponds to the currently displayed tab gets an active class.

You have the abilty to change those class names at initialization :

$('.ux-tabmenu').tabmenu({hiddenClass: 'my-hidden-class', activeClass: 'my-active-class'});

It's up to you to manage how the tabs should look like, how exactly you want to hide the tabs, etc. It may for example make sense to only visually hide tabs, but keep them accesible for screen readers. But things can be as easy as this :

.active{
	color: #cc0000;
}
.hidden{
	display: none;
}

tabmenu's People

Contributors

ls-yannick avatar

Watchers

Darío Hereñú avatar James Cloos avatar  avatar

Forkers

alidoon

tabmenu's Issues

Change markup order

It would be nice to change the markup order so that each label is directly above it's content. This could provide a clean way to disable the whole thing on screens that are too small for tabbed navigation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.