Popup Window stopped working after jQuery update

一个人想着一个人 提交于 2019-12-02 10:08:19

You can add the migration plugin to solve this problem.

In jQuery 1.9 a lot of deprecated methods was removed. jQuery.live is one of the removed methods, you can use jQuery.on as the replacement for live.

But if you have other dependend libraries which uses these deprecated functionalities then you can use the jQuery migration plugin for backward compatibility. It adds almost all the removed functionalities back to jQuery.

In your code, the live() event registration can be changed as below

$(document).on('click', 'a.close, #fade', function() { //When clicking on the close or fade layer...
    $('#fade , .popup_block').fadeOut(function() {
        $('#fade, a.close').remove();  //fade them both out
    });
    return false;
});

.live has been removed from 1.9. You can replace this syntax:

$('selector').live('event', function(e) {

With:

$(document).on('event', 'selector', function(e) {
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!