You can use the WidgetAnim
plugin to do this for you. It can be cleaner since the animations are stored in the plugin and invoked by the widget's hide
/show
functions.
I have quickly used the plugin to animate your overlay here: http://jsbin.com/ohafec/1/edit
Helpful links: