Giter Site home page Giter Site logo

redboss1 / jquery-hash-tabs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from srsgores/jquery-hash-tabs

0.0 1.0 0.0 1.72 MB

Анимированные табы URL-sensitive, hash-friendly tab plugin for jQuery

Home Page: http://srsgores.github.io/jquery-hash-tabs

CoffeeScript 53.77% Ruby 2.22% CSS 8.67% HTML 5.16% JavaScript 30.18%

jquery-hash-tabs's Introduction

Hash Tabs Build Status

URL-sensitive and hash-friendly tab plugin for jQuery

Getting Started

Download the production version or the development version.

First, install the package using bower:

bower install hash-tabs --save

Then, in your web page:

<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/hash-tabs/dist/jquery.hash-tabs.min.js"></script>
<script>
jQuery(function($) {
	$(".myTabContainer").hashTabs(); // "create hash tabs off of all elements with class myTabContainer"
});
</script>

Features

  • Hash-friendly URLs, so your states are saved. Try refreshing!
  • Compatible with IE8 and up
  • Customizable and configurable. Use custom selectors for your tabs. Default uses nav and section elements
  • noscript-friendly. Works very will in non-javascript browsers. When tabs can't be loaded, content feels like normal, as hashes are supported natively by the browser.
  • Customizable SASS styles, ready to go with my sass boilerplate
  • Bootstrap-free! But you can still use bootstrap if you really want to

Documentation

Documentation is generated using codoc. Please refer to the API docs.

Options

Option Default Description
tabPanelSelector "section" jQuery selector for individual tab panes (or tab content)
tabNavSelector "nav" jQuery selector for main navigation element, with tab buttons or links
tabButtonSelector "a" jQuery selector for anchor tags or links contained within the main navigation element
initialTabIndex 0 initial tab's index to show when the tabs are initialized
initialTabId null initial tab's id or hash to show when tabs are initialized
tabContainerClass "hash-tabs" class to append to initialized hash tabs
keyboard true Enable keyboard navigation using arrow keys
smoothScroll false Enable smooth scrolling to top of tabs when a tab is selected
history true Enable HTML5 history api, to navigate backwards/forwards amongst selected tabs
debug false Enable logging statements to diagnose any problems

Declare options in an object literal like so:

jQuery(document).ready(function() {
	var $tabs = $(".tab-container").hashTabs({
		debug: true,
		keyboard: true
		// other options here
	});
});

API

Trigger A Given Tab

(AKA trigger tab by id)

$(".myTabs").hashTabs("triggerTab", "chocolates") // triggers tab with id #chocolates

Trigger A Given Tab by Index

$(".myTabs").hashTabs("triggerTabByIndex", 1) // triggers second tab (with index 1) in tab set

Trigger Next Tab (to Right)

$(".myTabs").hashTabs("selectNext") // triggers right-most tab to current tab

Trigger Previous Tab (to Left)

$(".myTabs").hashTabs("selectPrevious") // triggers left-most tab to current tab

NOTE: tabs will cycle in a clockwise direction. For example, if you are on the last tab to the right, selecting next will fold back over to the first tab (0) to the left

Contributing

First, make sure to install all bower dependencies:

bower install

Next, install node dependencies:

npm install

Building

Currently, I am using the built-in grunt settings which ship with the yeoman generator I used.

Unit Tests

Unit tests are written using qunit. A js test driver configuration is also included for in-IDE testing (can use PHPStorm), but tests can also be run from the test/hash-tabs.html file.

jquery-hash-tabs's People

Contributors

billiaug avatar srsgores 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.