gpt4 book ai didi

jquery - jcrop 无法在 IE 上正常工作

转载 作者:行者123 更新时间:2023-12-01 04:55:46 25 4
gpt4 key购买 nike

我在 .net Web 应用程序中使用了裁剪。所有浏览器都对代码非常满意。然而,IE 显示出奇怪的行为。我尝试过其他帖子,但它们要么没有帮助,要么是一种黑客行为。这是 JavaScript 代码:

jQuery(function ($) {
api = $('<%= "#" + target.ClientID %>').Jcrop({
onChange: showCoords,
onSelect: showCoords,
onRelease: clearCoords,
aspectRatio: 1
}, function () {
api = this;
api.setSelect([10, 10, 110, 110]);
api.setOptions({ bgFade: true });
api.ui.selection.addClass('jcrop-selection');
});

});

第一次尝试时,IE 无法加载虚线,但有时第二次尝试时它可以工作。似乎是计时问题或图像加载问题...谢谢

最佳答案

Actually I found the problem, so I will first mention what is wrong with IE, then will describe my solution. As I stated in the question is a timing issue. IE loads the script before getting the picture from server.

To resolve that you have to wait until the picture is downloaded:

$('<%= "#" + target.ClientID %>').load(function () {
api = $('<%= "#" + target.ClientID %>').Jcrop({...

and the target is obviously my asp:Image control.

关于jquery - jcrop 无法在 IE 上正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14490709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com