Rewrite for modern jquery, may be some bugs, please report.