2

I am using bootstrap and jquery UI dialog.

At the top of my page there is a element which gets a z-index of 1000.

When I open one of my jquery UI dialogs, the z-index of the outer div is 101.

I have set the modal property to true but the top of the dialog appears behind some of the content from the header. Note that for the actual div in my markup,

<div id="divPopup" style="display: none; z-index:5000;"></div>

Appears fine because of the 5000. However, the top bar of the dialog appears behind content.

Is there a way to change the z-index of the wrapper div?

4
  • is this live somewhere? Commented Jan 12, 2017 at 18:39
  • have you tried $( this ).css( "z-index" , 1000 ); ? Commented Jan 12, 2017 at 18:39
  • Could you provide a little more code? For example, you mention is divPopup your wrapper div or is it its parent? Commented Jan 12, 2017 at 19:01
  • divPopup is the div I display in the dialog, but jquery UI appends a wrapper div which has a z-index of 101 Commented Jan 12, 2017 at 19:26

3 Answers 3

5

You need to use pure css to set the dialog "on the top":

.ui-dialog { z-index: 1000 !important ;}

Full answer here

Sign up to request clarification or add additional context in comments.

Comments

1

You need to add a position to div for get z-index working.

<div id="divPopup" style="display: none;position:absolute, z-index:5000;"></div>

Comments

0

Most of the answers provided will change 'all' the z-indices of the available/declared dialogs. If you want to be specific, you can:

  1. Assign a class to the dialog when declaring it:
$('#divPopup).dialog({
        modal: true,
        draggable: true,
        classes: {'ui-dialog': 'dlg_wrap'}, // Assign a class 'dlg_wrap' to the dialog
    });
  1. Declare the z-index of the assigned class with CSS:
.dlg_wrap{z-index: 99999 !important;}

PS: Declaring inline CSS z-index to the div wont work. The dialog title will be excluded.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.