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

input fields on ios causing the navbar to hide #31

Open
morrow95 opened this issue Jul 28, 2016 · 2 comments
Open

input fields on ios causing the navbar to hide #31

morrow95 opened this issue Jul 28, 2016 · 2 comments

Comments

@morrow95
Copy link

Not sure if this has been going on for awhile now and I never noticed it or this is due to a newer version of this script.

I have a user login dropdown in my nav with two input fields. When the menu is collapsed (iPhone on ios) the menu works fine, BUT as soon as I tap any of the input fields the menu hides. I believe this is due to ios slightly zooming in the screen so the script thinks it scrolled and hides it.

I honestly don't remember this ever happening before as I would think I would have noticed it... plus I usually test things out pretty thoroughly. The only things that have changed recently are :

  • bootstrap 3.3.7
  • jquery 3.1.0
  • this plugin to 1.0.5

I 'think' I previously had 1.0.2 or 1.0.3 installed - I know it didn't have the navbarOffset option. Is there anything in the code since those that would cause this? Possibly the new bootstrap or jquery?

@morrow95
Copy link
Author

Thinking about this some more just now. Assuming the issue is what I think... the zooming of the screen makes the plugin think the page scrolled and closes the nav... what about 'disabling' navbar hiding if class="navbar-collapse collapse in" is present? The 'in' class just means the navbar is in a collapsed state and open or in other words you are in mobile view with the navbar open.

If that sounds reasonable it might be worthwhile to add a don't hide on mobile view option as well.

@morrow95
Copy link
Author

Kind of a hack, but I was able to make my solution work and prevent the navbar from disappearing when ios zooms in on the screen after touching an input field (in my case the username/password fields).

Added a condition in the script, but this requires you have an id 'navbar' set on your actual menu contents :

  function hide(autoHidingNavbar) {
    if (!_visible || $('#navbar').hasClass( 'in' )) {
      return;
    }

the html I use for my menu contents :

<nav id="navbar" class="navbar-collapse collapse">

which will have a class of 'in' added when in mobile/collapsed view and it is open.

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

No branches or pull requests

1 participant