我试过这个教程 link
我的代码是
<!DOCTYPE html>
<html>
<head>
<link href="cropper.css" rel="stylesheet" />
</head>
<body>
<img id="teh" src="image.png" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="cropper.js"></script>
<script>
$("#teh").cropper();
</script>
</body>
</html>
但是,它在 $("#teh").cropper();
处遇到错误 Uncaught TypeError: $(...).cropper is not a function
最佳答案
已经找到解决方案。我需要添加
<script src="jquery-cropper.js"></script>
这样就变成了
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="cropper.js"></script>
<script src="jquery-cropper.js"></script>
关于javascript - 未捕获的 TypeError : $(. ..).cropper 不是函数 - cropper.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59728272/