Material Tabs
How do I make an material tabs?
What is a material tabs? How do you make a material tabs? This script and codes were developed by Albert Miller on 23 August 2022, Tuesday.
Material Tabs - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Material Tabs</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="tab"> <div class="tab__header"><span class="tab__title">Address</span></div><!-- --><div class="tab__header"><span class="tab__title">Contacts</span></div><!-- --><div class="tab__header"><span class="tab__title">Notes</span></div> <div class="tab__underline"></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>
Material Tabs - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Roboto:400);
.tab { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); background-color: #fffff; display: inline-block; position: relative;
}
.tab__header { box-sizing: border-box; cursor: pointer; display: inline-block; padding: 1em 0; text-align: center; transition: border-bottom .4s; width: 10em;
}
.tab__title, .tab__title--active { color: rgba(0, 0, 0, 0.38); font-family: 'Roboto'; transition: color .4s;
}
.tab__title--active { color: #1976d2;
}
.tab__underline { background-color: #1976d2; bottom: 0; height: 5px; left: 0; position: absolute; right: 0; transform: translateX(0%) scaleX(0.33); transform-origin: left center; transition: transform .4s; width: 100%; z-index: 10000;
}
Material Tabs - Script Codes JS Codes
$(document).ready(function() { $('.tab__header:first-child').find('.tab__title').attr('class', 'tab__title--active');
});
var previousIndex = 0;
$('.tab__header').on('click', function(){ var tabIndex = $(this).index('.tab__header'); var tabLength = $('.tab .tab__header').length; var tabFinalIndex = tabLength - 1; var translateString = 'translateX(' var scaleString = 'scaleX(' var translateMathStart; if (previousIndex !== tabIndex) { if (tabIndex > previousIndex) { if (previousIndex === 0) { translateMathStart = 0; console.log('Translate Start: ' + translateMathStart); } else { translateMathStart = trimDecimal(previousIndex / tabLength); console.log('Translate Start: ' + translateMathStart); } } else if (tabIndex < previousIndex) { translateMathStart = trimDecimal(tabIndex / tabLength); console.log('Translate Start: ' + translateMathStart); } else if (tabIndex === 0) { translateMathStart = trimDecimal(tabIndex / tabLength); console.log('Translate Start: ' + translateMathStart); } var translateMathEnd = trimDecimal(tabIndex / tabLength); console.log('Translate End: ' + translateMathEnd); var scaleMathStart = (1 / tabLength) * (Math.abs((tabIndex - previousIndex)) + 1); console.log('Scale Start:' + scaleMathStart); var scaleMathEnd = 1 / tabLength; console.log('Scale End:' + scaleMathEnd); var styleStringStart = 'transform: ' + translateString + translateMathStart + '%) ' + scaleString + scaleMathStart + ')'; var styleStringEnd = 'transform: ' + translateString + translateMathEnd + '%) ' + scaleString + scaleMathEnd + ')'; //$('.tab__underline').attr('style', styleStringStart); $('.tab__underline').attr('style', styleStringEnd); window.setTimeout(function() { //$('.tab__underline').attr('style', styleStringEnd); }, 200); $('.tab__title--active').attr('class', 'tab__title'); $(this).find('.tab__title').attr('class', 'tab__title--active'); previousIndex = tabIndex; }
});
function trimDecimal(number) { number = +number.toFixed(2); if(number.toString().length > 2) { number = number.toString().slice(2, 4); } if(number.toString().length === 1 && number.toString() !== "0") { number = number.toString().concat("0"); } return number;
}
Developer | Albert Miller |
Username | SinceSidSlid |
Uploaded | August 23, 2022 |
Rating | 3 |
Size | 3,215 Kb |
Views | 32,384 |
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 |
Material Menu With Paging | 3,526 Kb |
Order Redesign | 5,080 Kb |
Alternative Material Tabs | 2,418 Kb |
Material Toggle Box Thing | 2,637 Kb |
Customer Select | 3,178 Kb |
Lunch and Browser Check | 4,546 Kb |
Dynamic Image Cover | 3,065 Kb |
Responsive Tables | 4,066 Kb |
Material Floating Action Button | 3,572 Kb |
Loading State 2 | 2,827 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 |
Two Element Typeface | Chrisota | 4,942 Kb |
Loading animation with css | Icebob | 2,947 Kb |
Javascript Welcome | Peterlewicki | 1,573 Kb |
Myprofile | SoufianeAbid | 2,451 Kb |
Vue.js Lazy Loading | Kjbrum | 3,620 Kb |
Sencha Touch 2.3.1 Basic Grid Example | Trozdol | 2,770 Kb |
Underlined form fields | Mitchdot | 2,323 Kb |
Button fills | Zubfatal | 5,205 Kb |
Box Shadow Effects | Retrofuturistic | 2,143 Kb |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 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!