Remember Tabs
How do I make an remember tabs?
What is a remember tabs? How do you make a remember tabs? This script and codes were developed by Joseph Cha on 05 January 2023, Thursday.
Remember Tabs - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Remember Tabs</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="tabs"> <div class="tab_heading" aria-controls="panel1" aria-selected="true">Tab 1</div> <div class="tab_heading" aria-controls="panel2" aria-selected="false">Tab 2</div> <div class="tab_heading" aria-controls="panel3" aria-selected="false">Tab 3</div> <div class="clear"></div> <div id="panel1" class="tab_panel" aria-hidden="false">Tab 1 Content</div> <div id="panel2" class="tab_panel" aria-hidden="true">Tab 2 Content</div> <div id="panel3" class="tab_panel" aria-hidden="true">Tab 3 Content</div> </div> <script src="js/index.js"></script>
</body>
</html>
Remember Tabs - Script Codes CSS Codes
* { box-sizing: border-box; } .tab_heading { float: left; border: 1px solid black; padding: 10px; cursor: pointer; width: 100px; } .clear { clear: both; } .tab_panel { width: 300px; border: 1px solid black; padding: 10px; } div[aria-hidden="true"] { display: none; }
Remember Tabs - Script Codes JS Codes
(function() { 'use strict'; var tabs = document.getElementById("tabs"); var tabPanels = document.querySelectorAll('.tab_panel'); var tabHeadings = document.querySelectorAll('.tab_heading'); var tabPanelsArray = [].slice.call(tabPanels); var tabHeadingsArray = [].slice.call(tabHeadings); function checkTabs(target, arr) { arr.forEach(function(currentItem, index, array) { if (currentItem !== target) { currentItem.setAttribute("aria-hidden", true); tabHeadings[index].setAttribute("aria-selected", false); } else { currentItem.setAttribute("aria-hidden", false); tabHeadings[index].setAttribute("aria-selected", true); } }); } function activateTab(event) { var tabTarget = event.target.getAttribute("aria-controls"); var tabTargetPanel = document.querySelector("#" + tabTarget); checkTabs(tabTargetPanel, tabPanelsArray); localStorage.setItem('lastTab', tabTarget); } tabHeadings.forEach(function(currentItem, index, array) { currentItem.addEventListener('click', activateTab); }); if (localStorage.length > 0) { var lastOpenedTab = document.getElementById(localStorage.getItem('lastTab')); checkTabs(lastOpenedTab, tabPanelsArray); }
}());
Developer | Joseph Cha |
Username | unionbank |
Uploaded | January 05, 2023 |
Rating | 3 |
Size | 2,179 Kb |
Views | 6,072 |
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 |
Mastering HTML Project Assignment | 2,029 Kb |
Friends List | 2,387 Kb |
HTML5 Semantic Structure | 2,705 Kb |
A Pen by Joseph Cha | 1,689 Kb |
HTML5 Forms | 2,073 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 |
CSS Colors | Alexpate | 2,232 Kb |
Airbnb Homepage | SindhujaD | 2,480 Kb |
Sort the Knowlege | Eprouver | 3,915 Kb |
Tile Animation Thing | Frxnz | 4,332 Kb |
Layout | X-gyba | 4,234 Kb |
Wavy Road with Dashes | Jonobr1 | 2,679 Kb |
RRC wrapSwitch | Pshrmn | 2,922 Kb |
C.Rowe Button | Brownerd | 2,473 Kb |
After America | Jonathangarner | 2,686 Kb |
Wikipedia Viewer | Odylic | 2,333 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!