Why not just set the opacity to about 50% of the parent window before starting the modal dialog, and then return to 100% when the modal dialog is rejected? This is not exactly what you are asking for, it performs the same function for the end user.
If you want to do something like your jQuery example, you really need to make a cap / supplement / set as the background idea that you described.
Paul sasik
source share