Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI dialog box appears at top of page while page is loading

Tags:

jquery-ui

I have a jQuery dialog box on my website. I give a div on the page the "dialog" id it's contents become the contents of the dialog box. However, when the page is loading, this div appears at the top of the page and looks bad. Does anyone know how to deal with this?

like image 530
Brian Avatar asked Jan 21 '26 01:01

Brian


2 Answers

Just hide your div via your CSS file:

#dialog {display: none}

This will not affect its actual display when the dialog is opened.

I tested to be sure, and this method worked with jQuery UI 1.7.2

like image 65
Doug Neiner Avatar answered Jan 25 '26 06:01

Doug Neiner


Assuming that the dialog is changing the 'display' style [eg using .show() and .hide()] then all jQueryUI is doing is setting the display style. thus, you can set the div with the display:none by default, and that way it won't show when you load.

like image 41
Michael Bray Avatar answered Jan 25 '26 05:01

Michael Bray



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!