You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
883 B

10 months ago
$(document).ready(function() {
var $wrapper = $('.sy-tab-wrapper'),
$allTabs = $wrapper.find('.sy-tab-content > div'),
$tabMenu = $wrapper.find('.sy-tab-menu li'),
$line = $('<div class="line"></div>').appendTo($tabMenu);
$allTabs.not(':first-of-type').hide();
$tabMenu.filter(':first-of-type').find(':first').width('100%')
$tabMenu.each(function(i) {
$(this).attr('data-tab', 'tab'+i);
});
$allTabs.each(function(i) {
$(this).attr('data-tab', 'tab'+i);
});
$tabMenu.on('click', function() {
var dataTab = $(this).data('tab'),
$getWrapper = $(this).closest($wrapper);
$getWrapper.find($tabMenu).removeClass('sy-active');
$(this).addClass('sy-active');
$getWrapper.find($allTabs).hide();
$getWrapper.find($allTabs).filter('[data-tab='+dataTab+']').show();
});
});//end ready