Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix side navigation experience

weronka8650e71a268e
diff --git a/saleor/static/js/dashboard.js b/saleor/static/js/dashboard.js
index 91f1cfa85a..2538e0f93f 100644
--- a/saleor/static/js/dashboard.js
+++ b/saleor/static/js/dashboard.js
@@ -29,6 +29,7 @@ $(document).ready(function() {
var wideScreen = 1650
var navWidth = '250px'
var $mainNav = $('#main-nav')
+ var mainNavTop = $mainNav.offset().top
var $menuToggle = $('.menu-toggle')
var $closeMenu = $('#close-menu')
var $openMenu = $('#open-menu')
@@ -43,7 +44,9 @@ $(document).ready(function() {
}
$openMenu.addClass('hide')
$closeMenu.removeClass('hide')
- $menuToggle.addClass('fixed')
+ $(window).scroll(function() {
+ $mainNav.toggleClass('sticky', $(window).scrollTop() > mainNavTop)
+ })
if ($(window).width() > tabletScreen) {
$.cookie('menu', 'open', { path: '/' })
}
@@ -54,7 +57,6 @@ $(document).ready(function() {
})
$closeMenu.addClass('hide')
$openMenu.removeClass('hide')
- $menuToggle.removeClass('fixed')
$.removeCookie('menu', { path: '/' })
if ($(window).width() < wideScreen) {
$('main .container, .subheader .nav-wrapper').css({
diff --git a/saleor/static/scss/dashboard.scss b/saleor/static/scss/dashboard.scss
index 88cb0a7a1f..5f2a18fe19 100644
--- a/saleor/static/scss/dashboard.scss
+++ b/saleor/static/scss/dashboard.scss
@@ -36,10 +36,6 @@ header {
position: absolute;
width: 237px;
z-index: 2;
- &.fixed {
- position: fixed;
- box-shadow: 2px 0px 5px 0px rgba(0, 0, 0, 0.20);
- }
i {
color: white;
}
@@ -125,7 +121,9 @@ header {
.side-nav {
width: 250px;
- margin-top: $header-height;
+ position: absolute;
+ top: $header-height + $subheader-height;
+ height: 100vh;
&-section {
p {
line-height: 1;
@@ -140,6 +138,10 @@ header {
border-top: 1px solid map-get($grey, lighten-2);
}
}
+ &.sticky {
+ position: fixed;
+ top: 0;
+ }
li {
display: block;
.body-home &.nav-home {