It now works before dom is ready :)
This commit is contained in:
parent
110765dbc1
commit
bc178a5228
@ -8,21 +8,22 @@
|
||||
* 8/17/2011
|
||||
*/
|
||||
|
||||
jQuery(function ($) {
|
||||
(function ($) {
|
||||
// hash change handler
|
||||
function hashchange () {
|
||||
var hash = window.location.hash
|
||||
, el = $('ul.tabs [href*="' + hash + '"]')
|
||||
, content = $(hash)
|
||||
|
||||
if (el.length) {
|
||||
$(el).closest('.tabs').find('.active').removeClass('active');
|
||||
$(el).addClass('active');
|
||||
|
||||
$(hash).show().addClass('active').siblings().hide().removeClass('active');
|
||||
if (el.length && !el.hasClass('active') && content.length) {
|
||||
el.closest('.tabs').find('.active').removeClass('active');
|
||||
el.addClass('active');
|
||||
content.show().addClass('active').siblings().hide().removeClass('active');
|
||||
}
|
||||
}
|
||||
|
||||
// listen on event and fire right away
|
||||
$(window).on('hashchange.skeleton', hashchange);
|
||||
hashchange();
|
||||
});
|
||||
$(hashchange);
|
||||
})(jQuery);
|
||||
|
Loading…
Reference in New Issue
Block a user