Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jmervine
Created February 24, 2014 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmervine/9197803 to your computer and use it in GitHub Desktop.
Save jmervine/9197803 to your computer and use it in GitHub Desktop.
// http://cdn.zoker.me/tools/tab-helper.js
$("input:text").focus(function(){
$(this).select();$(this).mouseup(function(a){
a.preventDefault();
})
});
$(window).load(function() {
var hash;
var hash_suffix='_tab';
if(document.location.href.split('#')[1]){
hash='#'+document.location.href.split('#')[1].replace(hash_suffix,'');
}
if(hash){
$('ul.nav.navbar-nav li a[href='+hash+']').tab('show');
}
});
function tabAction(ele){
var selected=$(ele).attr('href');document.location.href="/"+(document.location.search?document.location.search:'')+selected+hash_suffix;hash=selected;
}
function tryIt(n){
window.location.href="/?theme="+n+(hash?hash+hash_suffix:'');
}
function toggleCode(ele,name){
$('#'+name).toggleClass('hidden');$(ele).find('b').toggleClass('icon-caret-down');$(ele).find('b').toggleClass('icon-caret-up');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment