您好,我正在使用这个插件 https://github.com/fengyuanchen/cropper . 我想在引导模式中单击十字按钮时清除图像。我正在使用 jquery 的 cropper 插件。我也尝试了 cropper 的重置和清除功能,但它对我不起作用。请给我答案。
最佳答案
尝试这样的事情:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#clear').click(function(){
$('#img').attr('src', '');
// clear the src or remove the img tag and regenerate it.
});
});
</script>
<body>
<?php
$str = base64_encode(file_get_contents("https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcS1W0lHe_4U8pF3j7Ij_wxw-qx_N8ww713xOLWwBolGcUbBFvt5"));
echo "<img id='img' src='data:image/jpeg;base64, $str' width='100' height='100' >";
?>
<a href="javascript:void(0);" id="clear">Clear</a>
</body>
</html>
关于javascript - 如何在 cropper 插件中单击模态的交叉按钮清空图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42177551/