Skip to content

Instantly share code, notes, and snippets.

@farnhizzle
Created April 11, 2011 17:49
Show Gist options
  • Save farnhizzle/913931 to your computer and use it in GitHub Desktop.
Save farnhizzle/913931 to your computer and use it in GitHub Desktop.
This is a work in progress of a standard tab switcher function
if($('#payment-picker').length > 0) {
$('.discount-form').persistentPanel({
toggler: 'div.discounts h3 .toggle',
togglerContents: false,
togglerClass: {open: 'up', closed: 'down'},
cookieName: 'discountForm'
});
// transfer click on h3 to toggler for pP */
$('div.discounts h3').click(function(){$(this).find('div.toggle').click();});
// wtf mate? this only works if its WITH the usage
$.fn.toggleTabMenu = function(kickoff) {
this.find('ul li a').live('click', function(e){
$(this).closest('ul').find('a').removeClass('current');
$(this).addClass('current');
$(this).closest('div').find('> div').hide();
$('#' + $(this).attr('data-show-div')).show();
e.preventDefault();
});
kickoff.call(this);
return this;
};
$('#payment-picker').toggleTabMenu(function(){$(this).find('#credit-card-link').click()});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment