Code Monkey home page Code Monkey logo

htabs-js's Introduction

HTabs-js

JQuery plugin to render Tabs and navigation content by applying it to div.

HTML

at first we must add references to "htabs.js" and "htabs.css" as below.

<script type="text/javascript" src="scripts/htabs.js"></script>

<link href='styles/HTabs.css' rel='stylesheet' type='text/css' />

HTML is as simple as having a container div contains an un-ordered list, and another div with the class 'tabs_container' contains content divs with the class 'htabs-cont' as below.

to set selected tab add class 'htabs-selec' to the anchor element.

<div id='tabDiv' style="width: 400px">
    <ul>
        <li><a href="#exp1" class='htabs-selec'>tab1</a></li>
        <li><a href="#exp2">tab2</a></li>
        <li><a href="#exp3">tab3</a></li>
        <li><a href="#exp4">tab4</a></li>
    </ul>
    <div id="tabs_container" class='htabs-container'>
        <div id='exp1' class='htabs-cont'>
            content tab 1
        </div>
        <div id='exp2' class='htabs-cont'>
            content tab 2
        </div>
        <div id='exp3' class='htabs-cont'>
            content tab 3
        </div>
        <div id='exp4' class='htabs-cont'>
            content tab 4
        </div>
    </div>
</div>

###Javascript

the javascript is as below

$('#tabDiv').HTabs();

the plugin is provided with options as below

$('#tabDiv').HTabs({
    slideSpeed: 600,
    hoverClass: "hoverTest",
    tabClass: "defaultTest",
    selectedTabClass: "selectedTest",
    contentFixedHeight: true,
    contentHeight: '150px'
});

###CSS

the css is included in the plugin, and a default style is provided. you can always change the style by passing three main css classes like the optiones provided in the js example above.

Demo

a demo hosted in http://hdahamsheh.github.io/HTabs-js of two tabs; one is default and another applying custom options.

htabs-js's People

Contributors

hdahamsheh avatar mshahrouri avatar

Watchers

 avatar  avatar

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.