As I work on creating a navigation bar using Bulma and Vue.js, I encounter an issue with the dropdown menu behavior. When the navbar collapses into the hamburger menu, the dropdown list remains in display: block;
mode. To address this, I attempted a workaround that unfortunately applies the same style to all screen sizes.
To solve this problem, I experimented with binding styles directly in the template:
<div class="navbar-dropdown" :style="@media screen and (max-width: 900px){display: this.displayBlockAcad}">
This attempt resulted in an error message:
invalid expression: Invalid or unexpected token in
@media screen and (max-width: 900px){display: this.displayBlockAcad}
I created a jsfiddle demo for illustration purposes. If you remove
@media screen and (max-width: 900px)
from line 26, the jsfiddle will run without errors, but the is-hoverable
class in line 22 will stop working. Is there a way to make the dropdown hoverable on desktop screens while maintaining custom styling for media screens?