From 5e668f243bfd8919579fd94206f9f7aec0bf80b3 Mon Sep 17 00:00:00 2001 From: Dave Gamache Date: Wed, 17 Aug 2011 18:37:35 -0700 Subject: [PATCH] adding the actual tabs.js file --- javascripts/tabs.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 javascripts/tabs.js diff --git a/javascripts/tabs.js b/javascripts/tabs.js new file mode 100644 index 0000000..6317fda --- /dev/null +++ b/javascripts/tabs.js @@ -0,0 +1,40 @@ +/* +* Skeleton V1.0.3 +* Copyright 2011, Dave Gamache +* www.getskeleton.com +* Free to use under the MIT license. +* http://www.opensource.org/licenses/mit-license.php +* 7/17/2011 +*/ + +$(document).ready(function() { + + /* Tabs Activiation + ================================================= */ + $('ul.tabs > li').live('click', function(e) { + var $tab = $(this); + var $href = $tab.find('a:first'); + var $otherHrefs = $tab.siblings().find('a'); + var contentLocation = $href.attr('href'); + + //Let go if not a hashed one + if(contentLocation[0]=="#") { + e.preventDefault(); + + $otherHrefs.removeClass('active'); + + //Make Tab Active + if (!$href.hasClass('active')){ + $href.addClass('active'); + } + + //Show Tab Content & add active class + $(contentLocation) + .show() + .addClass('active') + .siblings() + .hide() + .removeClass('active'); + } + }); +}); \ No newline at end of file