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

Class "in" is not removed from collapsed menu when screen became bigger #13245

Closed
ghost opened this issue Mar 31, 2014 · 10 comments
Closed

Class "in" is not removed from collapsed menu when screen became bigger #13245

ghost opened this issue Mar 31, 2014 · 10 comments

Comments

@ghost
Copy link

ghost commented Mar 31, 2014

In this link http://jsfiddle.net/tZXTv/

1 -

has two classes: collapse navbar-collapse

1

2 -

the class "collapse" has his position changed, and a class "in" is add

1

3 - If resize the screem without click on this
1

this classes "navbar-collapse collapse in" aren't change

1

and why? because if i want to style the collapsed menu i need some class of reference, the only one is "in", and if this class is not removed i dont know what I can use a reference to style.

@hnrch02
Copy link
Collaborator

hnrch02 commented Mar 31, 2014

Duplicate of #11653, please search next time.

@cvrebert
Copy link
Collaborator

However, that issue was punted 3 months ago. Perhaps we can actually deal with it now.

@ghost
Copy link
Author

ghost commented Mar 31, 2014

Solved with this code:

$(window).on('resize', function () {
  if (window.innerWidth > 768) $('.navbar-collapse').removeClass('in')
})

customized from #11653

hope to see this kind of code in standard bootstrap soon, this is useful.

@cvrebert cvrebert added this to the v3.2.0 milestone Apr 1, 2014
@fat
Copy link
Member

fat commented Apr 2, 2014

@cvrebert i'd rather not add code like that to the dropdown plugin… maybe a good candidate for docs?

$(window).on('resize', function () {
  if (window.innerWidth > 768) $('.navbar-collapse').removeClass('in')
})

@fat
Copy link
Member

fat commented Apr 2, 2014

or we could just add to the bottom of the collapse plugin with a comment…feels kinda jank tho

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 2, 2014

No, I think it's a good candidate for actually including in the plugin. 😀 We just need to un-hardcode the width and maybe put it inside a method if you want it to be opt-in. Having the navbar be broken like this feels jank.

@mdo
Copy link
Member

mdo commented Apr 2, 2014

Yeah, it'd be awesome to have the collapse plugin use a data attribute for the collapse. I don't think that's something we can just roll into v3.x though, no?

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 2, 2014

Hmm, why not? As long as we fall back to the current lack-of-behavior when the attribute is absent, seems like it should be fine.

@cvrebert cvrebert changed the title Class "in" is not removed in collapsed menu when screem became bigger Class "in" is not removed from collapsed menu when screen became bigger Apr 7, 2014
@mdo mdo removed this from the v3.2.1 milestone Jun 19, 2014
@mdo
Copy link
Member

mdo commented Jun 19, 2014

Punting to v4 because I want to rethink a bunch of this and complicating the plugin more sounds like a bad idea to me right now. Also I think the JS and CSS to make the current behavior and the new stuff happen would probably be a shit show.

@mdo mdo closed this as completed Jun 19, 2014
@cvrebert
Copy link
Collaborator

Similar: google/web-starter-kit#79

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

No branches or pull requests

4 participants