Skip to content

Commit

Permalink
Open submenu on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahtanjz committed Jan 25, 2021
1 parent be946d0 commit 7164878
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/vue-components/src/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<slot slot="button" name=button></slot>
<slot slot="_header" name="_header"></slot>
<slot slot="header" name="header"></slot>
<slot slot="dropdown-submenu" name="dropdown-menu" :class="menuClasses"></slot>
<slot slot="dropdown-submenu" name="dropdown-menu"></slot>
<slot></slot>
</submenu>
<div v-else ref="dropdown" :class="classes">
Expand Down
14 changes: 8 additions & 6 deletions packages/vue-components/src/Submenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</slot>
</a>
</slot>
<slot name="dropdown-menu" :class="menuClasses">
<ul class="dropdown-menu" :class="menuClasses">
<slot name="dropdown-menu">
<ul class="dropdown-menu">
<slot></slot>
</ul>
</slot>
Expand All @@ -31,10 +31,6 @@ export default {
type: String,
default: '',
},
menuAlignRight: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down Expand Up @@ -103,6 +99,12 @@ export default {
}
return false;
});
$el.findChildren('a,button').on('mouseover', (e) => {
e.preventDefault();
if (window.innerWidth > 768) {
e.target.click();
}
});
},
beforeDestroy() {
const $el = $(this.$refs.submenu);
Expand Down

0 comments on commit 7164878

Please sign in to comment.