bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Dropdown.js

Open cpherjennings opened this issue 15 years ago • 12 comments

I know this has been discussed before, but the dropdown functionality is either broken or mis-documented. It's not even possible to get the dropdown sample working correctly by copying & pasting. That is a big problem. I've tried searching the docs, applying fixes, etc. but to no avail. Even copying the samples verbatim doesn't work. Please fix this documentation issue so we can all bask in the glory of this app.

Before you ask, I've literally tried everything mentioned in the issues list and via Google and nothing works--I literally cannot reproduce even the demo application.

thanks, Chris

cpherjennings avatar Sep 19 '11 18:09 cpherjennings

I included the bootstrap-dropdown.js file and added data-dropdown="dropdown" to an li class="dropdown" element and it worked fine. Are you getting JS errors in the console?

jacobfike avatar Sep 19 '11 18:09 jacobfike

Sorry to hear you're having problems, can you create a jsfiddle of it not working?

fat avatar Sep 19 '11 18:09 fat

Not sure how much of a sample I can give. Here's what I've done:

  1. Include bootstrap-dropdown.js in head
  2. included HTML
  3. At end of HTML include js

Here's the HTML (a slightly customized version of the stock sample -- using ASP.NET MVC):

At the end of the file:

cpherjennings avatar Sep 19 '11 19:09 cpherjennings

sorry, github destroyed my markup

cpherjennings avatar Sep 19 '11 19:09 cpherjennings

Here's the markup in jsfiddle: http://jsfiddle.net/cpherjennings/FBP66/

cpherjennings avatar Sep 19 '11 19:09 cpherjennings

You need to include the bootstrap-modal.js file on your page. It doesn't appear to be in your fiddle...

fat avatar Sep 19 '11 20:09 fat

When I change the stylesheet link for bootstrap to <link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css"> and run it in jsfiddle, the dropdown works fine. Clicking on admin opens a menu with change password.

What browser are you using?

jacobfike avatar Sep 19 '11 20:09 jacobfike

oh nice catch jacob! works for me too

fat avatar Sep 20 '11 02:09 fat

I figured out what was happening. In my code sample I left out the code that loads a flex app (via swfobject.js). The top navigation bar sits immediately on top of the flex app. So, when clicking the dropdown link, the part that drops down is being obscured by the flex app. I've tried changing the z-index value of the "li" in the dropdown but that doesn't seem to help. Still working on this... But at least I was able to get the dropdown working out of the box. Thanks!

cpherjennings avatar Sep 20 '11 14:09 cpherjennings

So, with a swf, you need to set the WMode to transparent (it's a flash var) in order to allow HTML to appear on top of it.

jacobfike avatar Sep 20 '11 16:09 jacobfike

awesome good to hear!

fat avatar Sep 20 '11 17:09 fat

Holy shit, you are a life-saver, Jacob. Bonus points to you. That works fabulously. After researching this, I can't believe I didn't figure that out, but normally our Flex apps don't co-mingle with HTML (i.e. they're full-screen). Nice catch!

cpherjennings avatar Sep 20 '11 17:09 cpherjennings