Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery(function(){
accordionEffect("#ac-ts-1", "#accordi-on1");
accordionEffect("#ac-ts-2", "#accordi-on2");
accordionEffect(".ac-ts-3", "#accordi-on3", "ts3-");
});
/**
Define uma função abstrair o efeito accordion
@var bclick = Elemento que receberá o click
@var target = Elemento que irá sofrer o efeito
@prefix = Add um prefix nas classes
**/
function accordionEffect(bclick, target, prefix){
var pre = typeof prefix !== 'undefined' ? prefix : '';
var element = jQuery(bclick);
element.click(function(){
if (element.hasClass(pre+"arrow-up")){
element.removeClass(pre+'arrow-up').addClass(pre+'arrow-down');
}else{
element.removeClass(pre+'arrow-down').addClass(pre+"arrow-up");
}
jQuery(target).slideToggle("slow");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.