Bones/javascripts/tabs.js

29 lines
673 B
JavaScript
Raw Normal View History

2012-03-01 17:30:57 -05:00
/**
* Skeleton V1.1
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 8/17/2011
*/
2011-08-17 21:37:35 -04:00
jQuery(function ($) {
// hash change handler
function hashchange () {
var hash = window.location.hash
, el = $('ul.tabs [href*="' + hash + '"]')
2011-08-17 21:37:35 -04:00
if (el.length) {
$(el).closest('.tabs').find('.active').removeClass('active');
$(el).addClass('active');
$(hash).show().addClass('active').siblings().hide().removeClass('active');
}
}
// listen on event and fire right away
$(window).on('hashchange.skeleton', hashchange);
hashchange();
2012-03-01 17:30:17 -05:00
});