Jcrop IE8无法正常工作(Jcrop IE8 not work)

编程入门 行业动态 更新时间:2024-10-25 02:19:19
Jcrop IE8无法正常工作(Jcrop IE8 not work)

我的jCrop有问题。 他在其他浏览器中的funcuina但不在IE8中工作。 我找不到问题。 如果是图像数据的问题或不允许裁剪的图像尺寸。 有人可以帮忙吗?

<script type="text/javascript"> jQuery(document).ready(function () { // Create variables (in this scope) to hold the API and image size var jcrop_api, boundx, boundy; var $targetImage = jQuery('.targetImage'), targetImageDOM = $targetImage[0]; var carregarJcrop = function () { $targetImage.Jcrop({ onChange: updatePreview, onSelect: updatePreview, aspectRatio: 1 }, function () { // Use the API to get the real image size var bounds = this.getBounds(); boundx = bounds[0]; boundy = bounds[1]; // Store the API in the jcrop_api variable jcrop_api = this; }); function updatePreview(c) { if (parseInt(c.w) > 0) { var rx = 231 / c.w; var ry = 231 / c.h; jQuery('#x').val(c.x); jQuery('#y').val(c.y); jQuery('#w').val(c.w); jQuery('#h').val(c.h); jQuery('.jcrop-preview').css({ width: Math.round(rx * boundx) + 'px', height: Math.round(ry * boundy) + 'px', marginLeft: '-' + Math.round(rx * c.x) + 'px', marginTop: '-' + Math.round(ry * c.y) + 'px' }); } }; }; var checaCarregamento = function () { if (targetImageDOM.complete) { carregarJcrop() } else { setTimeout(checaCarregamento, 500); } }; if ($targetImage.length > 0) setTimeout(checaCarregamento, 500); });

I have a problem with jCrop. He funcuina in other browsers but not working in IE8. I can not find the problem. If it is a problem of image data or the image size that does not allow the crop. Can someone help??

<script type="text/javascript"> jQuery(document).ready(function () { // Create variables (in this scope) to hold the API and image size var jcrop_api, boundx, boundy; var $targetImage = jQuery('.targetImage'), targetImageDOM = $targetImage[0]; var carregarJcrop = function () { $targetImage.Jcrop({ onChange: updatePreview, onSelect: updatePreview, aspectRatio: 1 }, function () { // Use the API to get the real image size var bounds = this.getBounds(); boundx = bounds[0]; boundy = bounds[1]; // Store the API in the jcrop_api variable jcrop_api = this; }); function updatePreview(c) { if (parseInt(c.w) > 0) { var rx = 231 / c.w; var ry = 231 / c.h; jQuery('#x').val(c.x); jQuery('#y').val(c.y); jQuery('#w').val(c.w); jQuery('#h').val(c.h); jQuery('.jcrop-preview').css({ width: Math.round(rx * boundx) + 'px', height: Math.round(ry * boundy) + 'px', marginLeft: '-' + Math.round(rx * c.x) + 'px', marginTop: '-' + Math.round(ry * c.y) + 'px' }); } }; }; var checaCarregamento = function () { if (targetImageDOM.complete) { carregarJcrop() } else { setTimeout(checaCarregamento, 500); } }; if ($targetImage.length > 0) setTimeout(checaCarregamento, 500); });

最满意答案

你使用的是最新版本吗? 似乎有一个IE8修复:

IE 8修复

Are you using the latest version? Seems there is an IE8 fix:

IE 8 Fix

更多推荐

function,jQuery,var,image,电脑培训,计算机培训,IT培训"/> <meta name="des

本文发布于:2023-08-03 20:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1396258.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   工作   Jcrop   work

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!