Agregar o eliminar clases

/**This function prevent close de modal window on click in metro style button */ $('.centroDeAplicaciones').on('click', function(){ if ($('.ult-overlay').hasClass('ult-open')) { $('.centroDeAplicaciones').removeClass('overlay-show'); }else{ $('.centroDeAplicaciones').addClass('overlay-show'); } /*Add atributes for tabs function on click*/ var selector = ".centroDeAplicaciones"; $(selector).attr("data-vc-tabs", ""); /*Add class to this button on click and remove in all others with the same class*/ $('.centroDeAplicaciones').click(function(e){ $('.centroDeAplicaciones').removeClass('metroIconActive'); $(this).addClass('metroIconActive'); }); }); /********************************************************************************************************/ jQuery(document).ready(function(){ jQuery(".accordion-toggle").click(function(){ if(jQuery(this).attr('class').indexOf("active")==-1) { jQuery(this).addClass("active"); }else{ jQuery(this).removeClass("active"); } }); }); /*AGREGAR CLASE AL HACER CLIC Y ELIMINAR ESTA MISMA CLASE AL ELEMENTO QUE FUE CLICADO ANTERIORMENTE*/ $('.centroDeAplicaciones').click(function(e){ $('.centroDeAplicaciones').removeClass('metroIconActive'); $(this).addClass('metroIconActive'); }); /********************************************************************************************************/ you can try this along, it may help to give a shorter code on large function. $('#menu li a').on('click', function(){ $('li a.current').toggleClass('current'); }); $('#menu li a').on('click', function(){ $('li a.current').removeClass('current'); $(this).addClass('current'); }); --------------------------------- $('#menu li a').on('click', function(){ $(this).addClass('current').parent().siblings().find('a').removeClass('current'); }); /********************************************************************************************************/ // Wait until the DOM has loaded before querying the document jQuery(document).ready(function(){ var $x = jQuery.noConflict(); $x('div.tabs-area').each(function(){ // For each set of tabs, we want to keep track of // which tab is active and it's associated content var $xactive, $xcontent, $xlinks = $x(this).find('a'); // Use the first link as the initial active tab $xactive = $xlinks.first().addClass('active'); $xcontent = $x($xactive.attr('href')); // Hide the remaining content $xlinks.not(':first').each(function () { $x($x(this).attr('href')).hide(); }); // Bind the click event handler $x(this).on('click', 'a', function(e){ // Make the old tab inactive. $xactive.removeClass('active'); $xcontent.hide(); // Update the variables with the new link and content $xactive = $x(this); $xcontent = $x($x(this).attr('href')); // Make the tab active. $xactive.addClass('active'); $xcontent.show(); // Prevent the anchor's default click action e.preventDefault(); }); }); });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.