Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何自由剪裁图像_Javascript_Html_Css - Fatal编程技术网

Javascript 如何自由剪裁图像

Javascript 如何自由剪裁图像,javascript,html,css,Javascript,Html,Css,首先,这是关于一个网站的移动版本 我的目标是在它的中心拍摄一个图像剪辑,让用户可以随意左右移动 我相信我是错误的脚和剪辑值不应该使用不要采取我的代码,并试图修复它可能是完全错误的 我有一个想法,以某种方式隐藏图像左右,但我不知道如何实现它 <!DOCTYPE html> <html> <head> <title></title> <style> .center-cropped { width: 500px;

首先,这是关于一个网站的移动版本 我的目标是在它的中心拍摄一个图像剪辑,让用户可以随意左右移动

我相信我是错误的脚和剪辑值不应该使用不要采取我的代码,并试图修复它可能是完全错误的

我有一个想法,以某种方式隐藏图像左右,但我不知道如何实现它

<!DOCTYPE html>
<html>
<head>
<title></title>
  <style>
   .center-cropped {
    width: 500px;
    height: 800px;
    background-position: center center;
    background-repeat: no-repeat;
    overflow: hidden;
   }

.center-cropped img {
min-height: 100%;
min-width: 100%;
/* IE 8 */
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  /* IE 5-7 */
 filter: alpha(opacity=0);
 /* modern browsers */
 opacity: 0;
 }
 </style>
  </head>
<body>
 <script>

 </script>
<div class="center-cropped" style="background-image:     url('office.gif');">
  <img src="http://placehold.it/400x400" />
</div>
</body>
</html>

.中间裁剪{
宽度:500px;
高度:800px;
背景位置:中心;
背景重复:无重复;
溢出:隐藏;
}
.中心裁剪img{
最小高度:100%;
最小宽度:100%;
/*IE 8*/
-ms过滤器:“progid:DXImageTransform.Microsoft.Alpha(不透明度=0)”;
/*IE 5-7*/
过滤器:alpha(不透明度=0);
/*现代浏览器*/
不透明度:0;
}

检查此链接您所说的免费是什么意思?你想在几行css中找到类似的东西吗?@FrontEndCoder这看起来很像,但它符合我的需要,前提是我可以在图像左右添加两块白色,并且它们不会显示在浏览器中,而只显示在图像中。“你知道这是否可能吗?”劳伦斯·切隆你就是那个人。我希望图像保持它的属性,虽然它应该有它的全部高度,并且只能左右移动。我会试着自己找的,我会和你联系的answer@scriver请您分享一下您希望如何查看输出的内容好吗