Created
March 14, 2014 07:41
-
-
Save pafnuty/9543555 to your computer and use it in GitHub Desktop.
tabs + event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Табы с генерацией события (на всякий случай) | |
$('body').on('click touch', 'ul.tabs li:not(.current):not(.disabled)', function(callback) { | |
thisTab = $(this); // Определяем переменную текущего таба | |
thisTab | |
.addClass('current') // добавляем класс текущему табу | |
.siblings().removeClass('current') // Удаляем класс у остальных табов в блоке | |
.parents('.tab-section') // Находим родительский блок | |
.find('.box').eq(thisTab.index()) // Находим нужный блок | |
.fadeIn(150, function () { // Показываем его | |
thisTab.trigger('tabClick'); // и генерируем событие tabClick | |
}) | |
.siblings('.box').hide(); // Прячем остальные блоки с контентом | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment