1 Star 0 Fork 0

Zzzz / big_event-Z

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
头像裁切初体验.html 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
Zzzz 提交于 2023-06-05 21:59 . 第三天更改
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./assets/lib/cropper/cropper.css" />
<style>
body {
display: flex;
}
.container {
width: 600px;
height: 500px;
}
img {
width: 600px;
height: 500px;
}
.w200 {
width: 200px;
height: 200px;
}
.w100 {
width: 100px;
height: 100px;
}
.w50 {
width: 50px;
height: 50px;
}
.w30 {
width: 30px;
height: 30px;
}
.preview {
background-color: #ccc;
margin: 10px;
/* 预览的图片溢出部分隐藏 */
overflow: hidden;
}
</style>
</head>
<body>
<div class="container">
<img src="./assets/images/sample2.jpg">
</div>
<div class="preview_box">
<div class="preview w200"></div>
<div class="preview w100"></div>
<div class="preview w50"></div>
<div class="preview w30"></div>
</div>
<script src="./assets/lib/jquery.js"></script>
<script src="./assets/lib/cropper/Cropper.js"></script>
<script src="./assets/lib/cropper/jquery-cropper.js"></script>
<script>
// 1.1 获取裁剪区域的 DOM 元素
let $image = $(".container img");
// 1.2 配置选项
let options = {
// 纵横比
aspectRatio: 1,
// 指定预览区域
preview: ".preview",
};
// 1.3 创建裁剪区域
$image.cropper(options);
</script>
</body>
</html>
1
https://gitee.com/xy7d/big_event-zzzzz.git
git@gitee.com:xy7d/big_event-zzzzz.git
xy7d
big_event-zzzzz
big_event-Z
master

搜索帮助