Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add background #99

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build-bundle": "vue-cli-service build --target lib --name vue-burger-menu ./src/components/index.js"
},
"dependencies": {
"vue": "^2.5.17"
"vue": "^2.6.11"
},
"author": {
"name": "Mohit Bajoria",
Expand All @@ -27,12 +27,15 @@
"url": "git+https://github.com/mbj36/vue-burger-menu.git"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.0",
"@vue/cli-plugin-eslint": "^3.0.0",
"@vue/cli-service": "^3.0.0",
"less": "^3.8.1",
"less-loader": "^4.1.0",
"vue-template-compiler": "^2.5.17"
"@vue/cli-plugin-babel": "^4.4.6",
"@vue/cli-plugin-eslint": "^4.4.6",
"@vue/cli-service": "^4.4.6",
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
"eslint-plugin-vue": "^6.2.2",
"less": "^3.12.2",
"less-loader": "^6.2.0",
"vue-template-compiler": "^2.6.11"
},
"main": "./dist/vue-burger-menu.common.js",
"license": "MIT",
Expand Down
31 changes: 21 additions & 10 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div>
<div ref="overlay" class="bm-overlay" :class="{'open': isSideBarOpen, 'close': !isSideBarOpen}"></div>
<div ref="sideNav" class="bm-menu">
<nav class="bm-item-list">
<slot></slot>
Expand Down Expand Up @@ -110,15 +111,9 @@
if (e && e.target) {
target = e.target;
}

if (
element &&
element !== target &&
!element.contains(target) &&
!this.hasClass(target,'bm-menu') &&
this.isSideBarOpen &&
!this.disableOutsideClick
) {

if(this.isSideBarOpen && target===this.$refs.overlay && !this.disableOutsideClick) {
//Close opened sidebar when click on overlay
this.closeMenu();
} else if (
element &&
Expand Down Expand Up @@ -247,7 +242,7 @@
height: 100%; /* 100% Full-height */
width: 0; /* 0 width - change this with JavaScript */
position: fixed; /* Stay in place */
z-index: 1000; /* Stay on top */
z-index: 1100; /* Stay on top */
top: 0;
left: 0;
background-color: rgb(63, 63, 65); /* Black*/
Expand All @@ -274,5 +269,21 @@
font-weight: 700;
color: white;
}
.bm-overlay {
position: fixed;
z-index: 1000;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
}
.bm-overlay.close {
opacity: 0;
transition: opacity 0.3s ease 0s, transform 0s ease 0.3s;
transform: translate3d(100%, 0px, 0px);
}
.bm-overlay.open {
opacity: 1;
transition: opacity 0.3s ease 0s;
}
</style>

Loading