Stacked Card Navigation

Developer
Size
3,205 Kb
Views
2,024

How do I make an stacked card navigation?

What is a stacked card navigation? How do you make a stacked card navigation? This script and codes were developed by Cmalven on 29 January 2023, Sunday.

Stacked Card Navigation Previews

Stacked Card Navigation - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Stacked Card Navigation</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="tab tab-1">HAL</div> <div class="tab tab-2">VICI</div> <div class="tab tab-3">KITT</div> <div class="tab tab-4">BISHOP</div>
</div> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Stacked Card Navigation - Script Codes CSS Codes

.container { width: 320px; height: 480px; background-color: #ddd; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; overflow: hidden;
}
.tab { cursor: pointer; position: absolute; padding: 32px; top: 0; right: 0; bottom: 0; left: 0; box-shadow: 0 0 70px rgba(0, 0, 0, 0.8); font-family: 'Avenir'; font-weight: 700; font-size: 38px; color: #fff; -webkit-font-smoothing: antialiased;
}
.tab:hover { -webkit-filter: grayscale(0.3); filter: grayscale(0.3);
}
.tab-1 { background-color: #0085a1;
}
.tab-2 { background-color: #3d2471;
}
.tab-3 { background-color: #28a636;
}
.tab-4 { background-color: #ae001f;
}

Stacked Card Navigation - Script Codes JS Codes

'use strict';
var $container = $('.container');
var $tabs = $('.tab');
var $activeTab = null;
var height = $container.outerHeight();
var eachHeight = height / $tabs.length;
var collapsedHeight = 20;
var resetTabs = function resetTabs() { for (var idx = 0; idx < $tabs.length; idx++) { var $tab = $tabs.eq(idx); var targetY = idx * eachHeight; TweenLite.to($tab, 0.5, { y: targetY, ease: Power3.easeOut }); } $activeTab = null;
};
var selectTab = function selectTab(selectedIdx) { if ($activeTab) return resetTabs(); $activeTab = $tabs.eq(selectedIdx); var targetY = null; for (var idx = 0; idx < $tabs.length; idx++) { var $tab = $tabs.eq(idx); if (idx <= selectedIdx) { targetY = idx * collapsedHeight; } else { targetY = height - collapsedHeight * ($tabs.length - idx); } TweenLite.to($tab, 0.5, { y: targetY, ease: Power3.easeOut }); }
};
resetTabs();
$tabs.on('click', function (evt) { var idx = $tabs.index($(this)); selectTab(idx);
});
Stacked Card Navigation - Script Codes
Stacked Card Navigation - Script Codes
Home Page Home
Developer Cmalven
Username cmalven
Uploaded January 29, 2023
Rating 3
Size 3,205 Kb
Views 2,024
Do you need developer help for Stacked Card Navigation?

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!

Cmalven (cmalven) Script Codes
Create amazing sales emails with AI!

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!