[feature] scroll menu content to top when navigating tabs
This commit is contained in:
parent
ccc4060f64
commit
1aa93166c5
|
@ -7,7 +7,7 @@
|
|||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transition: background-color var(--animation-speed-fast) ease-in-out;
|
||||
transition: background-color var(--animation-speed-slow) ease-in-out;
|
||||
}
|
||||
|
||||
.header-background {
|
||||
|
|
|
@ -14,8 +14,13 @@ var menu = (function() {
|
|||
}, false);
|
||||
};
|
||||
|
||||
var _scrollToTop = function(element) {
|
||||
element.scrollTop = 0;
|
||||
};
|
||||
|
||||
var _tab = function(button) {
|
||||
var allMenuNavButton = helper.eA(".menu-nav-button");
|
||||
var menuContent = helper.e(".menu-content");
|
||||
var allMenuContentArea = helper.eA(".menu-content-area");
|
||||
var target = helper.e(button.dataset.target);
|
||||
allMenuNavButton.forEach(function(arrayItem, index) {
|
||||
|
@ -26,6 +31,7 @@ var menu = (function() {
|
|||
});
|
||||
helper.addClass(button, "active");
|
||||
helper.removeClass(target, "is-hidden");
|
||||
_scrollToTop(menuContent);
|
||||
};
|
||||
|
||||
var close = function() {
|
||||
|
@ -34,6 +40,7 @@ var menu = (function() {
|
|||
};
|
||||
|
||||
var open = function() {
|
||||
_scrollToTop(helper.e(".menu-content"));
|
||||
state.get().menu.active = true;
|
||||
render();
|
||||
};
|
||||
|
@ -42,6 +49,7 @@ var menu = (function() {
|
|||
if (state.get().menu.active) {
|
||||
state.get().menu.active = false;
|
||||
} else {
|
||||
_scrollToTop(helper.e(".menu-content"));
|
||||
state.get().menu.active = true;
|
||||
};
|
||||
render();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var version = (function() {
|
||||
|
||||
// version is normally bumped when the state needs changing or any new functionality is added
|
||||
var current = "2.5.0";
|
||||
var current = "2.6.0";
|
||||
|
||||
var get = function() {
|
||||
var number = current.split(".");
|
||||
|
|
Loading…
Reference in New Issue