These blog posts are incredibly helpful and have inspired me to pass it forward and share the incremental bits that I can. One thing that I've wanted to do that I just got working in my sandbox was to make these modal popups draggable and/or resizable. As I've come to learn, jquery makes this ridiculously easy.
If you look at the source code for the draggable example on jquery's site, you'll see that it's 3 parts:
- The references to the jquery library
- The jquery function
- The div that you want to make draggable
1. A reference to the jquery libraries. You should probably use static resources, but if you're just testing it out, something like this needs to be on your page:
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"/>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
2. Add the jquery script and don't forget the noConflict() requirement. In my example, I have a div called "pop" that I want to make draggable and resizable.
<script type="text/javascript">
$j = jQuery.noConflict();
$j(function() {
$j( "[id$='pop']" ).draggable().resizable();
});
</script>
3. The div/outputpanel becomes something like this:
<apex:outputPanel id="popupBackground" styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel id="custPopup" layout="block" rendered="{!displayPopUp}" >
<div id="pop" Class="custPopup">
<!-- your form/pageblock/fields/tables go here-->
<apex:outputPanel id="custPopup" layout="block" rendered="{!displayPopUp}" >
<div id="pop" Class="custPopup">
<!-- your form/pageblock/fields/tables go here-->
Part 3 depends on your styling but it should be pretty easy to apply to your modal popup. If all goes well you should be able to move your panel around and resize it. Enjoy!