0

在从 jquery ui 1.6 升级到 1.9.2 时,曾经完美运行的选项卡功能现在被破坏了!选项卡甚至不再可见。我检查了“好”和“坏”页面之间的 html 标记,没有区别。

我有一个名为 livequery 的插件已经过时,可能是造成这种情况的原因。此外,我有一堆语法已弃用的绑定。我根据 jquery ui upgrade guide 更新了所有已弃用的代码,尽我所知。但是,这些都不起作用。遇到这个问题的人可以分享他们的见解吗?我的“升级”jquery ui 选项卡代码如下:

var Tabs = {
    init: function() {
        this.tabs = this.getTabs();
        this.on();
    },
    getTabs: function() {
        return jQuery(this.tabNode()).tabs({
            //ajaxOpts deprec
            //ajaxOptions: { global: false },
            beforeload: function(event, ui) {
                ui.ajaxSettings.global = false;
            },
            //select deprec
            //select: function() { jQuery('#waitmsg').activate() },
            option: function() {
                jQuery('#waitmsg').activate()
            },
            load: function() {
                jQuery('#waitmsg').hide()
            }
        });
    },
    tabNode: function() {
        return '#schools_tab > ul';
    },
    on: function() {
        this.onHighSchoolTab();
        this.onMidSchoolTab();
        this.onElemSchoolTab();
    },
    selected: function() {
        return this.tabs.data('selected.tabs');
    },
    refreshSelected: function() {
        jQuery(this.tabNode()).tabs('load', this.selected());
    },
    refreshIfSelected: function(index) {
        if (this.selected() == index) {
            jQuery(this.tabNode()).tabs('load', index);
        }
    },
    handleError: function(request) {
        eval(request.responseText);
    },
    // grab the last element of the id of an element.
    parseID: function(el) {
        return el.id.split('_').pop();
    },
    get: function(xfa, accountID, context) {
        $j.get('index.cfm', {
            fuseaction: xfa,
            accountID: accountID,
            context: context
        }, null, 'script');
    },
    post: function(href, data, callback) {
        if (!data) data = {};
        if (!callback) callback = null;
        $j.ajax({
            type: 'POST',
            href: href,
            data: data,
            dataType: 'script',
            success: callback,
            error: function(request) {
                // evaluate alert from error block, ignore errors
                try {
                    eval(request.responseText);
                } catch (err) {}
            }
        });
    },
    // define each tab binding
    onHighSchoolTab: function() {
        FormBinder.on('hischools');
        $j('#school_context input').livequery('click', function() {
            var context = $j(this).val();
            Tabs.get('hischools.list', Tabs.parseID(this), context);
            // Update the new note link to reflect the context change
            var link = $j('#new_schoollist').prop('href');
            $j('#new_schoollist').prop('href', link.replace(/context=\w+/, 'context=' + context));
        });
        $j('#show_all_schools').livequery('click', function() {
            Tabs.post(this.href, {}, function(data, textStatus) {
                $j('#show_all_schools').hide();
            });
            return false;
        });
        $j('#school_list a.delete').livequery('click', function() {
            if (confirm('Are you sure you want to delete this school?')) {
                Tabs.post(this.href);
            }
            return false;
        });
    }
}
4

0 回答 0