Jquery Tab Plugin
How do I make an jquery tab plugin?
Quick stab at a custom Jquery Tab Plugin. What is a jquery tab plugin? How do you make a jquery tab plugin? This script and codes were developed by Altitude on 23 September 2022, Friday.
Jquery Tab Plugin - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Jquery Tab Plugin</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ /* ========= Get Fonts */
@import url(https://fonts.googleapis.com/css?family=Quicksand);
@import url(https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);
/* ================ Assign Variables */
/* =========================== Setup Mixins/Helper Classes */
.clearfix:after, .container:after, .tab-nav:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;
}
/* ========== Setup Page */
*, *:before, *:after { box-sizing: border-box;
}
body { padding: 3em; background-image: url(https://subtlepatterns.com/patterns/retina_wood.png); color: grey; font-family: 'Quicksand', sans-serif;
}
/* ================= Container Styling */
.container { position: relative; background: white; padding: 3em; border-radius: 10px;
}
/* =========== Tab Styling */
.tab-group { position: relative; border: 1px solid #eee; margin-top: 2.5em; border-radius: 0 0 10px 10px;
}
.tab-group section { opacity: 0; height: 0; padding: 0 1em; overflow: hidden; transition: opacity 0.4s ease, height 0.4s ease;
}
.tab-group section.active { opacity: 1; height: auto; overflow: visible;
}
.tab-nav { list-style: none; margin: -2.5em -1px 0 0; padding: 0; height: 2.5em; overflow: hidden;
}
.tab-nav li { display: inline;
}
.tab-nav li a { top: 1px; position: relative; display: block; float: left; border-radius: 10px 10px 0 0; background: #eee; line-height: 2em; padding: 0 1em; text-decoration: none; color: grey; margin-top: .5em; margin-right: 1px; transition: background .2s ease, line-height .2s ease, margin .2s ease;
}
.tab-nav li.active a { background: #6EB590; color: white; line-height: 2.5em; margin-top: 0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="container"> <div class="tab-group"> <section id="tab1" title="Long Tab Name"> <h3> Content 1 </h3> <p> Aliquam eleifend magna mauris, id egestas eros dictum ac. Vivamus ac turpis at nisi mattis aliquam. In hac habitasse platea dictumst. </p> </section> <section id="tab2" title="Another Tab"> <h3> Content 2 </h3> <p> Donec congue ligula non risus dictum, eget vehicula diam mattis. Pellentesque at ante ipsum. Suspendisse rutrum elementum dolor, non congue risus sagittis id. </p> </section> <section id="tab3" title="Tab 3"> <h3> Content 3 </h3> <p> Vivamus sem odio, mattis vel dui aliquet, iaculis lacinia nibh. Vestibulum tincidunt, lacus vel semper pretium, nulla sapien blandit massa, et tempor turpis urna eu mi. </p> </section> <section id="tab4" title="Another Tab"> <h3> Content 4 </h3> <p> Donec congue ligula non risus dictum, eget vehicula diam mattis. Pellentesque at ante ipsum. Suspendisse rutrum elementum dolor, non congue risus sagittis id. </p> </section> <section id="tab5" title="Another Tab"> <h3> Content 5 </h3> <p> Donec congue ligula non risus dictum, eget vehicula diam mattis. Pellentesque at ante ipsum. Suspendisse rutrum elementum dolor, non congue risus sagittis id. </p> </section> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Jquery Tab Plugin - Script Codes CSS Codes
/* ========= Get Fonts */
@import url(https://fonts.googleapis.com/css?family=Quicksand);
@import url(https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);
/* ================ Assign Variables */
/* =========================== Setup Mixins/Helper Classes */
.clearfix:after, .container:after, .tab-nav:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;
}
/* ========== Setup Page */
*, *:before, *:after { box-sizing: border-box;
}
body { padding: 3em; background-image: url(https://subtlepatterns.com/patterns/retina_wood.png); color: grey; font-family: 'Quicksand', sans-serif;
}
/* ================= Container Styling */
.container { position: relative; background: white; padding: 3em; border-radius: 10px;
}
/* =========== Tab Styling */
.tab-group { position: relative; border: 1px solid #eee; margin-top: 2.5em; border-radius: 0 0 10px 10px;
}
.tab-group section { opacity: 0; height: 0; padding: 0 1em; overflow: hidden; transition: opacity 0.4s ease, height 0.4s ease;
}
.tab-group section.active { opacity: 1; height: auto; overflow: visible;
}
.tab-nav { list-style: none; margin: -2.5em -1px 0 0; padding: 0; height: 2.5em; overflow: hidden;
}
.tab-nav li { display: inline;
}
.tab-nav li a { top: 1px; position: relative; display: block; float: left; border-radius: 10px 10px 0 0; background: #eee; line-height: 2em; padding: 0 1em; text-decoration: none; color: grey; margin-top: .5em; margin-right: 1px; transition: background .2s ease, line-height .2s ease, margin .2s ease;
}
.tab-nav li.active a { background: #6EB590; color: white; line-height: 2.5em; margin-top: 0;
}
Jquery Tab Plugin - Script Codes JS Codes
;(function(defaults, $, window, document, undefined) { 'use strict'; $.extend({ // Function to change the default properties of the plugin // Usage: // jQuery.tabifySetup({property:'Custom value'}); tabifySetup : function(options) { return $.extend(defaults, options); } }).fn.extend({ // Usage: // jQuery(selector).tabify({property:'value'}); tabify : function(options) { options = $.extend({}, defaults, options); return $(this).each(function() { var $element, tabHTML, $tabs, $sections; $element = $(this); $sections = $element.children(); // Build tabHTML tabHTML = '<ul class="tab-nav">'; $sections.each(function() { if ($(this).attr("title") && $(this).attr("id")) { tabHTML += '<li><a href="#' + $(this).attr("id") + '">' + $(this).attr("title") + '</a></li>'; } }); tabHTML += '</ul>'; // Prepend navigation $element.prepend(tabHTML); // Load tabs $tabs = $element.find('.tab-nav li'); // Functions var activateTab = function(id) { $tabs.filter('.active').removeClass('active'); $sections.filter('.active').removeClass('active'); $tabs.has('a[href="' + id + '"]').addClass('active'); $sections.filter(id).addClass('active'); } // Setup events $tabs.on('click', function(e){ activateTab($(this).find('a').attr('href')); e.preventDefault(); }); // Activate first tab activateTab($tabs.first().find('a').attr('href')); }); } });
})({ property : "value", otherProperty : "value"
}, jQuery, window, document);
// Calling the plugin
$('.tab-group').tabify();
Developer | Altitude |
Username | altitudems |
Uploaded | September 23, 2022 |
Rating | 3.5 |
Size | 5,471 Kb |
Views | 18,216 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Semantic Tableless Calendar | 4,528 Kb |
VueJS Calendar Component | 8,913 Kb |
Baseline Grid | 7,369 Kb |
Semantic Tableless Calendar and Agenda | 6,099 Kb |
Expanding Breadcrumb Nav | 2,865 Kb |
Pricing Table v2 | 3,175 Kb |
Simple Grid System | 6,136 Kb |
A Pen by Altitude | 4,928 Kb |
CSS3 Buttons Flat | 5,065 Kb |
Off-Canvas Menu | 4,282 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Price Comparison Table | Orrinward | 3,459 Kb |
LAMP PURE CSS with Animation | Dam62500 | 2,911 Kb |
Loading Bar | Jaradlight | 2,333 Kb |
CSS background-size - GSAP | Jonathan | 2,209 Kb |
A vuejs widget | Chrgl86 | 2,869 Kb |
Classy Blockquote Styling | Andrewwright | 3,212 Kb |
Canvas Fireworks | Jackrugile | 6,200 Kb |
Console fun | Dviate | 1,500 Kb |
Scrolling Horizontal Isotope | Bramus | 2,017 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!