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

Menus all open if hidden by a media query on superfish.init() #113

Open
dholth opened this issue Mar 18, 2014 · 8 comments
Open

Menus all open if hidden by a media query on superfish.init() #113

dholth opened this issue Mar 18, 2014 · 8 comments
Labels

Comments

@dholth
Copy link

dholth commented Mar 18, 2014

If superfish.init() is called when the superfish menu is hidden (as by a media query setting display: none) then the hide() method opens all of the menus. When the browser grows to a size that is intended to show the superfish menu then all of the dropdowns are open and shown.

I noticed that the hide method calls $ul.show() and then $ul.stop(true, true) to attempt to instantly re-hide the menu. I'm not clear on why it does this, but it looks like something about the $ul.stop() call does not work when the menu is display: none.

@joeldbirch
Copy link
Owner

Interesting find. I'll keep it in mind when working on the next release. Thanks.

@dholth
Copy link
Author

dholth commented Apr 4, 2014

I did solve this. I set the .style property of the offending div to display: block, call superfish.init(), and immediately hide it again. There is no flash because javascript doesn't return to the browser during this operation. Sometimes it causes an error message on IE8, which we deal with by returning if .style is null or undefined.

@raduGaspar
Copy link

I believe that if you comment out line 141 in superfish.js, namely this:
$ul.show();

... it will work fine

@robgeorgeuk
Copy link

I've seen this issue when there is an iframe on the page. The full menu tree is expanded when you first hover over a menu item, the fix suggested by raduGaspar seems to work.

@joeldbirch joeldbirch added the bug label Mar 4, 2015
@joeldbirch
Copy link
Owner

I'm just wary that the fix suggested by @raduGaspar may cause other bugs. I remember I added that code for a reason.

@ghost
Copy link

ghost commented Mar 20, 2017

When the browser grows to a size that is intended to show the superfish menu then all of the dropdowns are open and shown.

When exactly does a browser "grow"? Is this a realistic scenario (e.g. happens when changing device orientation on iPad)? If not, seems like an implementation concern to me.

FYI - #158 (comment)

@dholth
Copy link
Author

dholth commented Mar 20, 2017

When you resize a desktop browser. It could happen when you rotate your ipad, sure.

@last-Programmer
Copy link

We are facing this issue in IE11 only and is there any plans for releasing official fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants