2

我正在使用 size_chart 扩展,它的 phtml 中有代码,但它与原型 js 冲突。这是产品视图页面上我的浏览器控制台中的错误。

prototype.js:5557 未捕获类型错误:无法读取未定义的属性“获取”

以下是该 phtml 上的 js 代码。

document.observe("dom:loaded", function () {
    Event.observe('sizechartbutton', 'click', showModal);
    var sizeChartObject = new sizeChart('sizechart_form');
    $('convertsizeunits').on('click', function (event) {
        sizeChartObject.changeUnits();
        Event.stop(event);
    });
    new Form.Observer('sizechart_form', 0.5, function () {
        sizeChartObject.findSize();
    });
});
var closeModal = function (e) {
    if (!e.target.descendantOf('sizechart')) {
        $('sizechartbox').removeClassName('_show');
        $('modals-overlay').remove();
    }
};
var showModal = function (event) {
    Event.stop(event);
    $('sizechartbox').addClassName('_show').setStyle({
        'z-index': '900'
    });
    $$('.modals-wrapper')[0].insert('<div id="modals-overlay" class="modals-overlay" style="z-index: 899;"></div>');
    Event.observe('sizechartbox', 'click', closeModal);
};
4

1 回答 1

2

请检查您的页面中是否存在“sizechartbutton”这个元素。因为它找不到您的元素。

于 2016-12-13T06:53:21.917 回答