jcrop将透明图像变黑 [英] jcrop turns transparent image black

查看:85
本文介绍了jcrop将透明图像变黑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用jcrop在无法修改的内置javascript内容中选择一个区域.我认为此javascript干扰了jcrop.因此我尝试将透明gif放在我要选择的内容上方.这阻止了干扰jcrop的事物,我可以选择良好的区域.但是,Jcrop正在使透明图像变黑,而不是透明.

I would like to use jcrop to select an area on something that has built in javascript which I can't modify. This javascript is interfering with jcrop i think. so I tried putting a transparent gif over the top of the thing I would like to select. This stopped the thing underneath interfering with jcrop and I coudl select areas fine. Jcrop, however, is making the transparent image black rather than transparent.

这是一个jsfiddle http://jsfiddle.net/andieje/rvTmX/

Here is a jsfiddle http://jsfiddle.net/andieje/rvTmX/

这是html

         <img id="cropbox" src="http://deepliquid.com/projects/Jcrop/demos/demo_files/sago.jpg" style="position: absolute; left: 0px: right: 0px;" />
<img id="transparent" src="http://www.golivetutor.com/download/spacer.gif" style="width: 100px; height: 100px;position: absolute; left: 0px: right: 0px;"/>

这只是显示链接到jcrop的透明图像及其变黑的方式.

This just shows a transparent image linked to jcrop and how it becomes black.

有什么办法可以解决这个问题?我不太了解css,但是如果修改意味着图像的未选中区域不再变灰,我就不会感到烦恼-我只想要选中位周围的矩形框即可.

Is there any way I could work around this? I dont know much css but I'm not bothered if the modifcation means that the unselected area of the image isn't greyed out anymore - I just want the bounded rectangle around the selected bit.

非常感谢您可以提供的任何帮助

thanks very much for any help you can give

推荐答案

这是因为jCrop中bgColor的默认选项设置为'black'.

That is because the default option for bgColor in jCrop is set to 'black'.

只需在您的init中添加bgColor的选项就没有任何内容,并且您的图像将是透明的:

Just add the option for bgColor in your init to be nothing and your image will be transparent:

 $('#transparent').Jcrop({
    onChange: showCoords,
    bgColor: ''
},function(){
    jcrop_api = this;
});

这篇关于jcrop将透明图像变黑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆