Skip to content

Flash of Dropdown on pageload #205

@LizNix

Description

@LizNix

I've been using this navigation menu in my bootstrap/underscores wordpress starter theme. Over my last few projects I've developed the following method for dealing with the flash of dropdown on page load for desktop (above the breakpoint viewport size.)

  1. Set 'hover':false option when initiating flexnav

  2. use old school show/hide css in the media query targeting viewports above the breakpoint:

@media (min-width:800){
        .flexnav li > ul {
            display:none;
        }
        .flexnav li:hover > ul {
            display:block;
        }
    } 
  1. To override the inline style set by the core js plugin code, I then add !important to display:block.

That works but using !important indicates to me that there's a better way. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions