mirror of
https://github.com/flextype/flextype.git
synced 2025-08-18 10:51:21 +02:00
feat(admin-plugin): update tabs module #211
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
.tab--active
|
||||
.tabs__content
|
||||
{
|
||||
display: block!important;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-link--active
|
||||
.tabs__content--active
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.tabs__nav__link--active
|
||||
{
|
||||
@apply bg-dark-muted opacity-100;
|
||||
}
|
||||
|
@@ -1,31 +1,5 @@
|
||||
<script>
|
||||
function Tabs() {
|
||||
|
||||
var bindAll = function () {
|
||||
var menuElements = document.querySelectorAll('[data-tab]');
|
||||
for (var i = 0; i < menuElements.length; i++) {
|
||||
menuElements[i].addEventListener('click', change, false);
|
||||
}
|
||||
}
|
||||
|
||||
var clear = function () {
|
||||
var menuElements = document.querySelectorAll('[data-tab]');
|
||||
for (var i = 0; i < menuElements.length; i++) {
|
||||
menuElements[i].classList.remove('tab-link--active');
|
||||
var id = menuElements[i].getAttribute('data-tab');
|
||||
document.getElementById(id).classList.remove('tab--active');
|
||||
}
|
||||
}
|
||||
|
||||
var change = function (e) {
|
||||
clear();
|
||||
e.target.classList.add('tab-link--active');
|
||||
var id = e.currentTarget.getAttribute('data-tab');
|
||||
document.getElementById(id).classList.add('tab--active');
|
||||
}
|
||||
|
||||
bindAll();
|
||||
}
|
||||
|
||||
var connectTabs = new Tabs();
|
||||
$(".tabs__nav").on("click", ".tabs__nav__link:not(.tabs__nav__link--active)", function () {
|
||||
$(this).addClass("tabs__nav__link--active").siblings().removeClass("tabs__nav__link--active").closest("div.tabs").find("div.tabs__content").removeClass("tabs__content--active").eq($(this).index()).addClass("tabs__content--active");
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user