网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

jQuery自定义图片标注插件

时间:2024-10-12 10:06:31

1、新建html文档。

jQuery自定义图片标注插件

2、准备好需要用到的图标。

jQuery自定义图片标注插件jQuery自定义图片标注插件

3、书写hmtl代艨位雅剖码。<form action="" id="img熠硒勘唏form"><p>图片链接:</p><input type="text" name="src" value="build.jpg" style="display:block;width:100%;height:30px"><button class="addpic" type="submit" disabled="disabled" style="margin-top:10px;padding:10px;width:100%">点击标注图片</button></form>

jQuery自定义图片标注插件

4、书写css代码。<style>* { padding: 0; margin: 0 }.top-tab { background-color: #333; padding: 10px; margin-bottom: 50px }.top-tab a { display: flex; align-items: center; color: #fff }#imgform { margin: 0 auto; width: 500px }</style>

jQuery自定义图片标注插件

5、书写并添加js代码。<script src="scripts/jquery.js"></script><script src="scripts/jquery.imageLabel.min.js"></script><script> $(function() { $(".right-select-box"); $(".addpic").removeAttr("disabled"), $("#imgform").submit(function(t) { t.preventDefault(); window.c = imageLabel({ img: $("[name=src]").val(), editPop: !0, close: function(t) { return t.length && alert(JSON.stringify(t)), !0 }, clickArea: function() {}, edit: function(t) {}, startArea: function() {}, confirm: function(t) { return t.length && alert(JSON.stringify(t)), !0 } }) }) })</script>

jQuery自定义图片标注插件

6、代码整体结构。

jQuery自定义图片标注插件

7、查看效果。

jQuery自定义图片标注插件
© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com