jQueryUI 购物车拖放功能
2024-09-03 02:17:56
<style type="text/css">
.basket{
border:transparent solid 2px;
}
img{
width:80px;
height:80px;
}
.hover{
border-color:red;
}
</style> <h2>商品</h2>
<div id="b1" style="height:80px;width:100%;background-color:gainsboro;"> <img src="~/Content/images/1.bmp" />
<img src="~/Content/images/2.bmp" />
<img src="~/Content/images/3.bmp" />
<img src="~/Content/images/4.bmp" />
</div>
<h2>购物车</h2>
<div id="shop">
<img src="~/Content/images/cart.png" class="basket" width="" height=""/>
</div> <script> $("#b1 img").draggable({
revert: "invalid"
});
$("#shop img.basket").draggable({
disabled:"true"
})
$("#shop img.basket").droppable({
hoverClass: "hover",
drop: function (e, ui) {
$("#shop").append(ui.draggable);
$(ui.draggable).css({
position: "relative",
top: "0px",
left: "0px"
}).addClass("bought");
}
}); $("#b1").droppable({
accept:".bought",
drop: function (e, ui) {
$("#b1").append(ui.draggable);
$(ui.draggable).css({
position: "relative",
top: "0px",
left: "0px"
}).removeClass("bought");
}
}); </script>
最新文章
- Sigmaplot 13 破解版什么地方可以下载
- myeclipse 第一步
- Fiddler 手机端证书安装No root certificate was found
- 「2014-2-23」Note on Preliminary Introduction to Distributed System
- mysql win源码比较大 不需要的文件删除 记录下来
- Asp.net中的ajax回调模式(ICallbackEventHandler)
- Oracle private dblink和pubic dblink
- ASP.NET页面周期
- 得到一个div下 特定ID的所有标签
- c_select 调用参数说明
- 高性能日志类KLog(已开源代码)
- influxdb + Grafana可视化监控平台
- C/C++中的输入输出重定向
- vue2.4+vue-cli+webpack history模式打包后 刷新404
- Python_collections_namedtuple可命名元组
- python基础(6)-深浅拷贝
- Learning-Python【20】:Python常用模块(3)—— shelve、pickle、json、xml、configparser
- CodeForces - 444C
- 049 CDH商业版本的搭建(hadoop5.3.6 +hive+sqoop)
- python引入模块