Jquery JCrop functionality on fluid images

空扰寡人 提交于 2019-12-12 01:10:00

问题


So I have implemented JCrop on my image and now there has to be a design change, into making that image fluid.

My image has now max-height:100%;max-width:100% and it scales accordingly without JCrop, but with JCrop it doesn't and that is because JCrop sets a fixed witdth and height to the image on intialization, eg:

display: none; visibility: hidden; width:540px; height:430px;

$('#feature').children('img').eq(0).removeAttr('style');
$('#feature').children('img').attr('style','display: none; visibility: hidden; width:100% !important;height:100% !important;');

But with no avail, it just breaks JCrop.

All I need is to make the image and Jcrop itself adjust and maintain proportions on window resize. Any ideas on how to solve this?

Thanks!

EDIT

JSFIDDLE -> http://jsfiddle.net/EHQKH/2/

Just erase the javascript and you should see it resize on window/frame resize, with Jcrop it doesn't


回答1:


i have a look at this - jsFiddle

img {
    width:100%;
    height:100%;
}

i removed the style from the img and added it in css



来源:https://stackoverflow.com/questions/16815415/jquery-jcrop-functionality-on-fluid-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!