Fix animation and layout for offcanvas menu

Uses strategy from this forum comment:
http://foundation.zurb.com/forum/posts/547#comment_8840
This commit is contained in:
Kristina Lim
2019-07-15 17:57:36 +08:00
parent a93cf46f50
commit ca0f746cf1
7 changed files with 32 additions and 11 deletions

View File

@@ -0,0 +1,6 @@
$ ->
menu = $(".left-off-canvas-menu")
setOffcanvasMenuHeight = ->
menu.height($(window).height())
$(window).on("resize", setOffcanvasMenuHeight)
setOffcanvasMenuHeight()

View File

@@ -10,6 +10,7 @@
@import 'foundation-icons';
@import 'base/*';
@import 'layout/*';
@import '*';
@import 'pages/*';
@import '../web/all';

View File

@@ -0,0 +1,17 @@
@import "compass/css3/transition";
.off-canvas-fixed {
@include transition(transform 1000ms ease-in-out);
}
.move-right > .off-canvas-fixed {
height: 100%;
-webkit-transform: translate3d(15.625rem, 0, 0);
transform: translate3d(15.625rem, 0, 0);
}
.left-off-canvas-menu {
-webkit-transform: none;
transform: none;
margin-left: -15.625rem;
}

View File

@@ -222,7 +222,7 @@ nav.top-bar {
background-color: white;
}
.off-canvas-wrap.move-right ul.off-canvas-list {
.off-canvas-wrap ul.off-canvas-list {
font-size: 0.875rem;
.li-menu {
@@ -242,12 +242,10 @@ nav.top-bar {
background-color: transparent;
color: $brand-colour;
}
@include transition(all 0.3s ease-in-out);
}
}
.off-canvas-wrap.move-right ul.off-canvas-list i {
.off-canvas-wrap ul.off-canvas-list i {
font-size: 1.5rem;
margin-right: 0.25rem;
}

View File

@@ -42,9 +42,10 @@
= inject_currency_config
.off-canvas-wrap{offcanvas: true}
.inner-wrap
.fixed.off-canvas-fixed
= render "shared/menu/menu" unless @hide_menu
.inner-wrap
%section{ role: "main" }
= yield

View File

@@ -1,4 +1,4 @@
.fixed
= render partial: "shared/menu/large_menu"
%ofn-flash
= render partial: "shared/menu/mobile_menu"
= render "shared/menu/large_menu"
%ofn-flash
= render "shared/menu/mobile_menu"
= render "shared/menu/offcanvas_menu"

View File

@@ -20,5 +20,3 @@
%a{href: main_app.shop_path}
{{ CurrentHub.hub.name }}
= render partial: "shared/menu/offcanvas_menu" unless @hide_menu