我是 jquery 的新手。 当我的图像大于 div 大小时,我想拖动图像。 示例:当我们上传封面图片时,如果我的图片尺寸大于封面图片 div,那么他们会要求我们设置要显示的图片部分。 我想要这种类型的功能 我的代码是:
<div class="main">
<img class="absolute" src="http://jotform.org/demo/jquery-image-area-select-plugin/images/sweet-dogs.jpg" alt="" />
</div>
CSS:
.main{
width:300px;
margin: 0 auto;
overflow:hidden;
position: relative;
height: 100px;
}
img.absolute{
left: 50%;
margin-left: -200px;
top: 50%;
margin-top: -200px;
position:absolute;
}
希望你能理解我的问题
最佳答案
关于javascript - 当图像尺寸大于最小标准时拖动图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20603632/