本文主要是介绍H5 图片裁剪 - cropper 插件使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
本篇文章需要 js,jquery 等基础
cropper 下载
cropper 是一款 js 插件,下载地址:https://github.com/fengyuanchen/cropper/blob/master/README.md
jquery 下 cropper 使用步骤
引入文件
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/cropper.js"></script><!-- Cropper.js is required -->
<link href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/jquery-cropper.js"></script>
在 html 中放入一个 img 标签
<div><img id="image" src="picture.jpg">
</div>
在 js 中对 img 标签使用 cropper 方法
$('#image').cropper({aspectRatio: 1 /
这篇关于H5 图片裁剪 - cropper 插件使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!