嗨,我正在使用沟坑插件在我的项目中剪切图像。但是它在JQUERY的.on()方法中显示了一些错误,而在IE8中运行这个方法。请帮我解决这个问题。
这里是码页中的示例代码
在以下代码中显示错误
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中。提前感谢
发布于 2015-07-01 09:13:45
我用IE8加载了XP机箱,CodePen根本不运行,其他主要的沙箱(如JSFiddle或JSBin )也不运行。因此,我从CodePen (在一个工作框中)获取代码,并将其放入一个静态的HTML中。接下来,我链接到正确的Cropit源文件 (不是从他们的PR页面中提取的vendor.js ),遇到的第一个错误不是jQuery,而是克罗比特本身:
Object.defineProperty(exports, '__esModule', {
value: true
});对象不支持此属性或方法

随着研究的深入,IE8对defineProperty()的支持是有限的。实际上,从这个ECMA兼容位点中,IE8与大多数Object属性进行了斗争。
问题不在于您使用的是什么jQuery版本,而是IE8。您只需像微软将一样停止对它的支持。
发布于 2015-07-01 08:08:58
这在IE8 (真实版本)中工作得很好。
<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>https://stackoverflow.com/questions/31153948
复制相似问题