Skip to content

Instantly share code, notes, and snippets.

@ammardev
Last active February 26, 2019 13:43
Show Gist options
  • Save ammardev/8170a616e9d052f5f3d757c944488eb0 to your computer and use it in GitHub Desktop.
Save ammardev/8170a616e9d052f5f3d757c944488eb0 to your computer and use it in GitHub Desktop.
function changeTab(tabName) {
$('.tabstest .pmtab').removeClass('active');
$('.tabcontent').removeClass('active');
$('.tabstest .pmtab[data-tab='+ tabName + ']').addClass('active');
$("#"+tabName).addClass('active');
localStorage.setItem('current', tabName);
}
$(document).ready(function(){
var current = localStorage.getItem('current');
if(current)
changeTab(current);
$('.tabstest .pmtab').click(function(){
changeTab($(this).attr('data-tab'));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment