I have a jQuery dialog box that is meant to position in the middle of the screen. However, it seems slightly off-center vertically.
Here is the code:
None of the above solutions worked for me. I will present below my scenario and the final solution, just in case someone has the same problem.
Scenario: I use a custom jQuery plugin to add a scroll bar to an HTML element that is located inside the Dialog box.
I used it as
$(response).dialog({
create: function (event, ui) {
$(".content-topp").mCustomScrollbar();
})
});
The solution was to move it from create to open, like this:
$(response).dialog({
open: function (event, ui) {
$(".content-topp").mCustomScrollbar();
$(this).dialog('option', 'position', 'center');
})
});
So, if you use any custom jQuery plugin that manipulates the content then call it using the open event.