From ab7f365925d3354686757cee463cd6c21496f2d5 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 16 Apr 2018 15:15:01 -0400 Subject: [PATCH] scroll to top of overlay scroll top top of off canvas menu on sub menu click --- css/app.css | 2 +- js/app.js | 24 +----------------------- js/custom/pageSetup.js | 24 +----------------------- scss/_off-canvas.scss | 2 +- 4 files changed, 4 insertions(+), 48 deletions(-) diff --git a/css/app.css b/css/app.css index 5e15162..3bebe16 100644 --- a/css/app.css +++ b/css/app.css @@ -8072,7 +8072,7 @@ aside.oc-overlay { overflow-y: scroll; bottom: 0; background-color: white; - z-index: 2; + z-index: 11; cursor: pointer; } aside.oc-overlay li.page_item { diff --git a/js/app.js b/js/app.js index fb745e0..a1fec59 100644 --- a/js/app.js +++ b/js/app.js @@ -30,20 +30,7 @@ $(document).ready(function () { if( $(this).children('ul').length > 0 ){ let menuParent = $(this).parent(); - - - - - - - - - $(this).on("click", function(e){ - // if( $(this).parent().hasClass('children') ){ - // console.log("yes"); - // } - // collapse the nav menu that isn't in focus (primary or secondary) other_menu.toggleClass("oc-hidden"); @@ -53,25 +40,16 @@ $(document).ready(function () { // problem is here, this is a blanket toggle which affects sub menus unintentionally $(this).children('a').siblings('ul').toggleClass('oc-open'); - // $(this).children('a').siblings('ul').toggleClass('oc-hidden'); - // For animation purposes $(this).toggleClass('oc-expanded'); $(this).siblings().toggleClass("oc-collapsed"); + $('.oc-overlay').animate({ scrollTop: 0 }, "slow"); }) $(this).children('a').on('click', function(e){ e.preventDefault(); }) - - - - - - - - } else { let url = $(this).children('a').attr('href'); $(this).on("click", function(){ diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index a5da603..1710408 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -21,20 +21,7 @@ $(document).ready(function () { if( $(this).children('ul').length > 0 ){ let menuParent = $(this).parent(); - - - - - - - - - $(this).on("click", function(e){ - // if( $(this).parent().hasClass('children') ){ - // console.log("yes"); - // } - // collapse the nav menu that isn't in focus (primary or secondary) other_menu.toggleClass("oc-hidden"); @@ -44,25 +31,16 @@ $(document).ready(function () { // problem is here, this is a blanket toggle which affects sub menus unintentionally $(this).children('a').siblings('ul').toggleClass('oc-open'); - // $(this).children('a').siblings('ul').toggleClass('oc-hidden'); - // For animation purposes $(this).toggleClass('oc-expanded'); $(this).siblings().toggleClass("oc-collapsed"); + $('.oc-overlay').animate({ scrollTop: 0 }, "slow"); }) $(this).children('a').on('click', function(e){ e.preventDefault(); }) - - - - - - - - } else { let url = $(this).children('a').attr('href'); $(this).on("click", function(){ diff --git a/scss/_off-canvas.scss b/scss/_off-canvas.scss index 2cf4789..cdf2fe8 100644 --- a/scss/_off-canvas.scss +++ b/scss/_off-canvas.scss @@ -12,7 +12,7 @@ aside.oc-overlay { overflow-y: scroll; bottom: 0; background-color: white; - z-index: 2; + z-index: 11; cursor: pointer; } aside.oc-overlay li.page_item { -- 2.17.1