Coder Social home page Coder Social logo

tabs's Introduction

Simple and responsive Pure JS and css tab function (only 2.1kb)

Code tutorial

Installation

No need Jquery, or over frameworks or even libraries.

Just add this in the head section of your page : <link rel="stylesheet" href="tabs.css" />

and this just before the </body> tag :

    <script src="tabs.js"></script>
    <script>tabs('tabwrapper');</script>

Html

    <div id="tabwrapper">
        <div class="tab_linker">
            <span id="tabs1" class="tablinks">HTML</span>
            <span id="tabs2" class="tablinks">CSS</span>
            <span id="tabs3" class="tablinks">JS</span>  
        </div>
        <div id="tab1" class="tabcontent fade">First tab ! ...</div>
        <div id="tab2" class="tabcontent fade">... second tab ...</div> 
        <div id="tab3" class="tabcontent fade"><p>...and last tab content ! </p></div>
    </div>

CSS classes and id used in JS

id

tabwrapper div contenaire to wrap content inside

tab_linker wrapper for links/button

tabs1 span for link/button

tab1 div for content

classes

tablinks span for link/button

tabcontent div for content

fade only for effect (optional)

Options

X = integer x must be suitable !

Add a tab

just add :

  • a new span for link/button with id tabsX
  • a new div for content with id tabX

Remove a tab

just remove :

  • a remove a span for link/button with id tabsX
  • a remove a div for content with id tabX

Multiple tab

just add a new tab structure with a div to wrape content

with a new id like this :

<div id="tabwrapper_1"> ...

<div id="tabwrapper_2">...

Information

Version 1.0 février 2019

tabs's People

Contributors

pierrealexaline avatar

Watchers

 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.