if (typeof($) == 'undefined' && typeof(jQuery) != 'undefined') $ = jQuery; if (typeof($) != 'undefined'){ $(window).load(function(){ /* View/hide all partners */ $('.partners-table').each(function(){ var table_wrapper = $(this); var table_btn_less = $('tfoot .btn-less', this); var table_btn_more = $('tfoot .btn-more', this); table_btn_more.css('cursor', 'pointer').click(function(){ table_wrapper.find('.default_hidded').show(); table_btn_more.addClass('hidded'); table_btn_less.removeClass('hidded'); }); table_btn_less.css('cursor', 'pointer').click(function(){ table_wrapper.find('.default_hidded').hide(); table_btn_less.addClass('hidded'); table_btn_more.removeClass('hidded'); goToAnchor('partnerTabAnchor'); }); }); /* Tab control for the partners table. */ $('.partners-tables-geolocated').each(function(){ var tableWrapper = $(this); $('*[data-button-group]', tableWrapper).click(function(){ var buttonGroup = $(this).attr('data-button-group'); // Remove the active class from the tabs $('*[data-button-group]').removeClass('active'); // Add the active class to the current tab $(this).addClass('active'); // For each element, check if the value is the one we want. tableWrapper.find('.partners-table').hide(); tableWrapper.find('.partners-table-'+buttonGroup).show(); }); }); }); } function goToAnchor(anchor) { var offset = $("#"+anchor).offset() window.scrollTo(0,offset.top); return false; }