Second commit of version
This commit is contained in:
48
code/dist/js/tabby.js
vendored
Normal file
48
code/dist/js/tabby.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/* =============================================================
|
||||
|
||||
Tabby v2.0
|
||||
Simple, mobile-first toggle tabs by Chris Ferdinandi
|
||||
http://gomakethings.com
|
||||
|
||||
Free to use under the MIT License.
|
||||
http://gomakethings.com/mit/
|
||||
|
||||
* ============================================================= */
|
||||
|
||||
$(function () {
|
||||
|
||||
$('.tabs a, .tabs button').click(function(e) {
|
||||
e.preventDefault(); // Prevent default link behavior.
|
||||
var tabID = $(this).attr('data-target'); // Pull the data-target value as the tabID.
|
||||
|
||||
$(this).addClass('active').parent().addClass('active'); // Add the .active class to the link and it's parent li (if one exists).
|
||||
$(this).siblings().removeClass('active'); // Remove the .active class from sibling tab navigation elements.
|
||||
$(this).parent('li').siblings().removeClass('active').children().removeClass('active'); // Remove the .active class from sibling li elements and their links.
|
||||
$(tabID).addClass('active'); // Add the .active class to the div with the tab content.
|
||||
$(tabID).siblings().removeClass('active'); // Remove the .active class from other tab content divs.
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* =============================================================
|
||||
|
||||
Progressively Enhanced JS v1.0
|
||||
Adds .js class to <body> for progressive enhancement.
|
||||
|
||||
Script by Chris Ferdinandi.
|
||||
http://gomakethings.com
|
||||
|
||||
Free to use under the MIT License.
|
||||
http://gomakethings.com/mit/
|
||||
|
||||
* ============================================================= */
|
||||
|
||||
(function($) {
|
||||
$(function () {
|
||||
$('body').addClass('js'); // On page load, add the .js class to the <body> element.
|
||||
});
|
||||
})(jQuery);
|
Reference in New Issue
Block a user