首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IE8 - .on()函数在JQuery中不受ie8支持

IE8 - .on()函数在JQuery中不受ie8支持
EN

Stack Overflow用户
提问于 2015-07-01 06:25:00
回答 2查看 668关注 0票数 0

嗨,我正在使用沟坑插件在我的项目中剪切图像。但是它在JQUERY的.on()方法中显示了一些错误,而在IE8中运行这个方法。请帮我解决这个问题。

这里是码页中的示例代码

在以下代码中显示错误

代码语言:javascript
复制
 this.$fileInput.on("change.cropit", this.onFileChange.bind(this));
        this.$preview.on(Cropit.PREVIEW_EVENTS, this.onPreviewEvent.bind(this));
        this.$zoomSlider.on(Cropit.ZOOM_INPUT_EVENTS, this.onZoomSliderChange.bind(this));
        if (this.options.allowDragNDrop) {
            this.$preview.on("dragover.cropit dragleave.cropit", this.onDragOver.bind(this));
            return this.$preview.on("drop.cropit", this.onDrop.bind(this));
        }

错误仅显示在IE8中。提前感谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-07-01 09:13:45

我用IE8加载了XP机箱,CodePen根本不运行,其他主要的沙箱(如JSFiddle或JSBin )也不运行。因此,我从CodePen (在一个工作框中)获取代码,并将其放入一个静态的HTML中。接下来,我链接到正确的Cropit源文件 (不是从他们的PR页面中提取的vendor.js ),遇到的第一个错误不是jQuery,而是克罗比特本身:

代码语言:javascript
复制
Object.defineProperty(exports, '__esModule', {
  value: true
});

对象不支持此属性或方法

随着研究的深入,IE8对defineProperty()的支持是有限的。实际上,从这个ECMA兼容位点中,IE8与大多数Object属性进行了斗争。

问题不在于您使用的是什么jQuery版本,而是IE8。您只需像微软将一样停止对它的支持。

票数 0
EN

Stack Overflow用户

发布于 2015-07-01 08:08:58

这在IE8 (真实版本)中工作得很好。

代码语言:javascript
复制
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
<script>
$(document).ready(function () {
    this.$fileInput.on("change.cropit", this.onFileChange.bind(this));
        this.$preview.on(Cropit.PREVIEW_EVENTS, this.onPreviewEvent.bind(this));
        this.$zoomSlider.on(Cropit.ZOOM_INPUT_EVENTS, this.onZoomSliderChange.bind(this));
        if (this.options.allowDragNDrop) {
            this.$preview.on("dragover.cropit dragleave.cropit", this.onDragOver.bind(this));
            return this.$preview.on("drop.cropit", this.onDrop.bind(this));
        }
});
</script>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31153948

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档