Improve Dropdown

This commit is contained in:
Grzegorz Leoniec 2019-01-10 09:47:35 +01:00
parent 11bc54b851
commit a7010d32cf
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
4 changed files with 43 additions and 0 deletions

View File

@ -126,3 +126,23 @@ hr {
background-color: $color-neutral-80;
height: 1px !important;
}
#overlay {
display: block;
opacity: 0;
width: 100%;
height: 100%;
top: 0;
left: 0;
position: fixed;
background: rgba(0, 0, 0, 0.15);
z-index: 99;
pointer-events: none;
transition: opacity 150ms ease-out;
transition-delay: 50ms;
.dropdown-open & {
opacity: 1;
transition-delay: 0;
}
}

View File

@ -36,6 +36,27 @@ export default {
isPopoverOpen: false
}
},
watch: {
isPopoverOpen: {
immediate: true,
handler(isOpen) {
console.log('isOpen', isOpen)
try {
if (isOpen) {
setTimeout(() => {
document
.getElementsByTagName('body')[0]
.classList.add('dropdown-open')
}, 10)
} else {
document
.getElementsByTagName('body')[0]
.classList.remove('dropdown-open')
}
} catch (err) {}
}
}
},
beforeDestroy() {
clearTimeout(mouseEnterTimer)
clearTimeout(mouseLeaveTimer)

View File

@ -5,6 +5,7 @@
<nuxt />
</div>
</ds-container>
<div id="overlay" />
</div>
</template>

View File

@ -72,6 +72,7 @@
<nuxt />
</div>
</ds-container>
<div id="overlay" />
</div>
</template>