How can I get the dropdown menu to appear on top of the dialog?

mikeazo

I have a navbar at the top with some dropdown menus. I also have dialogs that pop up (using alertifyjs). I would like the dropdowns to be able to be on top of the dialogs. How can I do that?

I created a JSFiddle to illustrate.

HTML

<nav class="navbar navbar-default navbar-static-top">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

Javascript

$(document).ready(function() {
  alertify.alert('hello').set('modal', false).set('moveBounded', true);
});
creanium

You'll need to set a z-index in CSS on the drop-down/navbar to a value higher than what's set on the modal.

nav.navbar-static-top 
{
  z-index: 9999;
}

I checked the Fiddle you posted and the Modal has a z-index set to 1981, so a z-index of 9999 is sufficient to place it above the modal.

Based on your comments about your desired result, unfortunately because of the way the navbar is structured there's no easy way to have the navbar behind the alert but the dropdown be above the alert. So your best bet would be to do what I suggested above where the entire navbar stays on top of the alert, but configure the alert to always clear the navbar.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I set the Spinner menu to DropDown instaed of dialog style?

From Dev

Sticky menu - how can I get an image to appear as soon as it "sticks"?

From Dev

How can I make a border appear on top of it's content in WPF?

From Dev

How can I make a border only appear on the top?

From Dev

Polymer 1.0: How can I get the value of the selected item in a paper-dropdown-menu?

From Dev

How can I have a menu appear over an image after it is hovered on?

From Dev

How I can get values EditText a Dialog?

From Dev

Dropdown Menu wont appear

From Dev

Dropdown Menu wont appear

From Dev

How can I populate a dropdown menu with Mongodb in Meteor javascript?

From Dev

How can I center the items in the dropdown menu of bootstrap?

From Dev

How can I show an dropdown menu when update is clicked in gridview?

From Dev

How do I get rid of the extra space on the Dropdown menu?

From Dev

How do I get rid of the extra space on the Dropdown menu?

From Dev

how can i have a right alignment menu fill top in WPF

From Dev

How can I make an image bar to stay on top with the menu on mobile?

From Dev

how can i have a right alignment menu fill top in WPF

From Dev

How can I get menu item in NavigationView?

From Dev

How can i get menu description in Joomla

From Dev

How can I get menu data on Wordpress

From Dev

How do i remove the top box-shadow of a dropdown-menu in CSS?

From Dev

dropdown menu with top triangle

From Dev

How can I make a window appear on top of another window, without closing when I click the second?

From Dev

How can I make a postion: absolute; dialog initially appear within the viewport no matter where the page is scrolled?

From Dev

How can I make a postion: absolute; dialog initially appear within the viewport no matter where the page is scrolled?

From Dev

How do I get the Default app chooser dialog to appear even if the default app is already chosen already?

From Dev

How do i get a dialog to appear after first click from a Selectable using JQuery?

From Dev

How can I get uncaught exceptions to appear in the Django log

From Dev

How can I get a button to appear below a WebView inside a CoordinatorLayout

Related Related

  1. 1

    How can I set the Spinner menu to DropDown instaed of dialog style?

  2. 2

    Sticky menu - how can I get an image to appear as soon as it "sticks"?

  3. 3

    How can I make a border appear on top of it's content in WPF?

  4. 4

    How can I make a border only appear on the top?

  5. 5

    Polymer 1.0: How can I get the value of the selected item in a paper-dropdown-menu?

  6. 6

    How can I have a menu appear over an image after it is hovered on?

  7. 7

    How I can get values EditText a Dialog?

  8. 8

    Dropdown Menu wont appear

  9. 9

    Dropdown Menu wont appear

  10. 10

    How can I populate a dropdown menu with Mongodb in Meteor javascript?

  11. 11

    How can I center the items in the dropdown menu of bootstrap?

  12. 12

    How can I show an dropdown menu when update is clicked in gridview?

  13. 13

    How do I get rid of the extra space on the Dropdown menu?

  14. 14

    How do I get rid of the extra space on the Dropdown menu?

  15. 15

    how can i have a right alignment menu fill top in WPF

  16. 16

    How can I make an image bar to stay on top with the menu on mobile?

  17. 17

    how can i have a right alignment menu fill top in WPF

  18. 18

    How can I get menu item in NavigationView?

  19. 19

    How can i get menu description in Joomla

  20. 20

    How can I get menu data on Wordpress

  21. 21

    How do i remove the top box-shadow of a dropdown-menu in CSS?

  22. 22

    dropdown menu with top triangle

  23. 23

    How can I make a window appear on top of another window, without closing when I click the second?

  24. 24

    How can I make a postion: absolute; dialog initially appear within the viewport no matter where the page is scrolled?

  25. 25

    How can I make a postion: absolute; dialog initially appear within the viewport no matter where the page is scrolled?

  26. 26

    How do I get the Default app chooser dialog to appear even if the default app is already chosen already?

  27. 27

    How do i get a dialog to appear after first click from a Selectable using JQuery?

  28. 28

    How can I get uncaught exceptions to appear in the Django log

  29. 29

    How can I get a button to appear below a WebView inside a CoordinatorLayout

HotTag

Archive