updated jquery way to retrieve events on window