Using the position widget in a real-world example
So far, we've considered the theory behind using the position widget; before moving on to look at the widget factory, let us take a moment to consider how we can use the position widget in a real-world scenario.
A perfect example comes in the shape of jQuery UI's Dialog widget, configured to work as a modal dialog. Here we can use the position widget to place the dialog box on the page in relation to the button's current location.
To see how, add the following code to a new file in your text editor:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Dialog</title> <link rel="stylesheet" href="development-bundle/themes/redmond/jquery.ui.all.css"> <script src="js/jquery-2.0.3.js"></script> <script src="development-bundle/ui/jquery.ui.core.js"></script> <script src="development-bundle/ui/jquery.ui.widget.js"></script> <script src="development...