Skip to content

Instantly share code, notes, and snippets.

@DevShahidul
Created February 2, 2018 09:09
Show Gist options
  • Select an option

  • Save DevShahidul/7a64fc6d97142e15e34a48a3b6ce08f3 to your computer and use it in GitHub Desktop.

Select an option

Save DevShahidul/7a64fc6d97142e15e34a48a3b6ce08f3 to your computer and use it in GitHub Desktop.
$("ul.tabs").each(function(){
var $_this = $(this);
$_this.find(">li").eq(0).addClass("active");
$_this.parent().find("div.tab-content-wrap > div.pane").hide();
$_this.parent().find("div.tab-content-wrap > div.pane").eq(0).show();
$_this.find(" >li").each(function(i){
var $this_li = $(this);
$this_li.find("a").click(function(e){
e.preventDefault();
if($this_li.hasClass("active")) return false;
else{
$_this.find(">li").removeClass("active");
$this_li.addClass("active");
$_this.parent().find("div.tab-content-wrap > div.pane").hide();
$_this.parent().find("div.tab-content-wrap > div.pane").eq(i).show();
}
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment