From e959dba0e84cd08c883c6e816aea645b7cee3bd6 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 30 Jun 2016 15:55:52 +0000 Subject: [PATCH] #480 @1 --- .../application/views/helpers/HeaderNav.php | 2 +- js/101-header.js | 12 ++--- less/101-header.less | 53 ++++++++++++++++--- 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/framework/application/views/helpers/HeaderNav.php b/framework/application/views/helpers/HeaderNav.php index 512653b..4757e5f 100644 --- a/framework/application/views/helpers/HeaderNav.php +++ b/framework/application/views/helpers/HeaderNav.php @@ -6,7 +6,7 @@ class Fluidbook_View_Helper_HeaderNav extends CubeIT_View_Helper_Abstract { */ public function headerNav() { $mainMenu = $this->navigation()->findOneById($this->localeDefault() . '/' . CubeIT_Navigation::MAIN); - $res = $this->navigation()->menu()->renderMenu($mainMenu, array('maxDepth' => 0)); + $res = $this->navigation()->menu()->renderMenu($mainMenu, array('maxDepth' => 1)); return $this->htmlElement($res, 'nav', array('id' => 'menu', 'role' => 'navigation')); } } \ No newline at end of file diff --git a/js/101-header.js b/js/101-header.js index f88931d..3d01db4 100644 --- a/js/101-header.js +++ b/js/101-header.js @@ -12,7 +12,7 @@ function load_header() { htl = new TimelineMax(); // Background-color & height - htl.add(TweenMax.fromTo(h, 1.5, {height: 90}, {height: 56}), 0); + htl.add(TweenMax.fromTo(h, 1.5, {height: 90}, {height: 75}), 0); htl.add(TweenMax.fromTo($(h).find('#header'), 1.5, {height: 90}, {height: 56}), 0); // Logo var logo = $(h).find('.logo'); @@ -24,6 +24,7 @@ function load_header() { htl.add(TweenMax.fromTo($(logo).find('.text'), 1, {opacity: 1}, {opacity: 0}), 1.5); // Menu position htl.add(TweenMax.fromTo(nav, 1, {left: '50%'}, {left: 312}), 2); + htl.add(TweenMax.fromTo(h, 1, {backgroundColor: 'transparent'}, {backgroundColor: "rgba(255, 255, 255, 0.75)"}), 2); htl.stop(); $(window).on('cubeitresize', resizeHeader); @@ -35,8 +36,6 @@ function load_header() { } function resizeHeader() { - - headerScroll(); } @@ -54,7 +53,7 @@ function headerScroll() { if (formerScroll < s) { goingUp = false; } - + var adminHeight = $("#adminBar").outerHeight(); var headerHeight = $("header").outerHeight(); if (scrollUp != goingUp) { lastDirChange = s; @@ -79,11 +78,12 @@ function headerScroll() { htop = -scrolledDistance + headerPos; } else { // We retract the header when user scrolled down of 400px - htop = (400 - scrolledDistance) - headerHeight; + htop = (600 - scrolledDistance) - headerHeight; } + fb(htop); } // Normalize top value - $("header").css('top', Math.max(-headerHeight, Math.min(0, htop))); + $("header").css('top', Math.max(-headerHeight, Math.min(adminHeight, htop + adminHeight))); // Update formerScroll = s; scrollUp = goingUp; diff --git a/less/101-header.less b/less/101-header.less index 783759c..2b7e25a 100644 --- a/less/101-header.less +++ b/less/101-header.less @@ -5,6 +5,7 @@ header { top: 0px; left: 50%; transform: translateX(-50%); + z-index: 10; height: 90px; width: 100%; @@ -36,22 +37,19 @@ header { display: inline-block; } } + } nav#menu { position: relative; top: 57px; - left:50%; + left: 50%; width: 800px; margin-left: -400px; display: inline-block; text-align: center; - li { - margin: 0 25px; - } - a { line-height: 9px; border: 1px solid transparent; @@ -59,8 +57,49 @@ header { display: inline-block; } - li.active a, a:hover { - border-bottom-color: @color-header-grey; + > ul { + > li { + &.active > a, a:hover { + border-bottom-color: @color-header-grey; + } + &:hover { + > ul { + display: block; + } + } + margin: 0 25px; + position: relative; + > ul { + position: absolute; + top: 40px; + left: -20px; + background-color: #fff; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); + white-space: nowrap; + display: none; + &:before{ + content:""; + background-color: transparent; + height:20px; + width: 100%; + top:-20px; + left:0px; + position: absolute; + } + + > li { + display: block; + text-align: left; + + margin: 10px 20px; + + &.active a, a:hover { + border-bottom-color: transparent; + color: #e86f68; + } + } + } + } } } -- 2.39.5