I previously did some popups / dialogs that I’ve now got regression error in () and want to recode to use JQuery for the DIVs / popups / dialogs. Moving to Jquery will be an advantage since we can enable repositioning and resize for dialogs / popups which we can’t if the popup is just a DIV which places itself over the other elements.
Now I wonder what is the “best” way to make popups / dialogs / DIV appear with JQuery? I’d rather not add a plugin and only include the basic JQuery file. can you tell me how to do it?
The current page makes something like a popup but it is not repositionable.
The way I would do this is create a
.popupclass that contains the basic layout features for the popup. Then add this class to a hidden<div>at the top of the page.Then when a popup is needed, attatch the
draggableandresizableattributes of jQuery to it. After that, load the popup’s content with a.get()request from a page dedicated for popup content and then.show()it.Example
CSS
HTML
Javascript
Sources:
http://jqueryui.com/demos/resizable/
http://jqueryui.com/demos/draggable/