jquery easyui拖动商品添加购物车
近几年电商平台疯狂发展,商场网站比比皆是,模式架构也是大同小异,加入购物车的方式也变得多样化,点击,拖拽,比价,滑动等等,目的只有一个,激发消费者的购买欲望。
下面要分享的就是一个组通过拖动加入购物车的例子,这应该是很早以前的加入购物车的方法了,但是代码还是比较实用的,变通下可以作为一种图片添加或者对比的好方法!
源码如下:(ps:js文件真心贴不出来,小编也很苦恼,需要还是留邮箱吧,小编保证,只是发源码,绝不广告骚扰)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jquery easyui拖到商品添加购物车实例代码</title>
</head>
<body>
<style type="text/css">
/* reset */
*{margin:0;padding:0;list-style-type:none;}
a{blr:expression(this.onFocus=this.blur())}/*去掉a标签的虚线框,避免出现奇怪的选中区域*/
:focus{outline:0;}
label{cursor:pointer;}
img{vertical-align:middle;}
table{empty-cells:show;border-collapse:collapse;border-spacing:0;}
h1{font-size:16px;}h2,h3,h4{font-size:14px;}h5,h6{font-size:12px;}
abbr,acronym{border:0;font-variant:normal}
address,caption,cite,code,dfn,em,th,var,optgroup{font-style:normal;font-weight:normal}
input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit}
input,button,textarea,select{*font-size:100%}
a,img{border:0;}
a,a:visited{color:#5e5e5e; text-decoration:none;}
a:hover{color:#4183C4;text-decoration:underline;}
.clear{display:block;overflow:hidden;clear:both;height:0;line-height:0;font-size:0;}
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
.clearfix{display:inline-table;}/* Hides from IE-mac \*/
*html .clearfix{height:1%;}
.clearfix{display:block;}/* End hide from IE-mac */
*+html .clearfix{min-height:1%;}
body{font:12px/180% Arial,Lucida,Verdana,"宋体",Helvetica,sans-serif;color:#333;background:#fff;}
/* shortcut */
.shortcut{height:32px;line-height:32px;font-size:12px;background:#eee;text-transform:uppercase;box-shadow:1px 0px 2px rgba(0,0,0,0.2);border-bottom:1px solid #DDDDDD;}
.shortcut h1{font-size:14px;font-family:"微软雅黑","宋体";}
.shortcut a,.shortcut h1{padding:0px 10px;letter-spacing:1px;color:#333;text-shadow:0px 1px 1px #fff;display:block;float:left;width:360px;height:32px;overflow:hidden;}
.shortcut a:hover{background:#fff;}
.shortcut span.right{float:right;display:inline-block;width:468px;height:15px;overflow:hidden;margin:8px 5px 0 0;}
.shortcut .close{
background:url(/Public/images/close-demo.gif) no-repeat 0 0;width:20px;height:20px;line-height:99em;overflow:hidden;display:inline-block;margin:6px 10px 0 10px;float:right;padding:0;
-webkit-transition:all .3s ease-out 0s;
-moz-transition:all .3s ease-out 0s;
-ms-transition:all .3s ease-out 0s;
-o-transition:all .3s ease-out 0s;
transition:all .3s ease-out 0s;
}
.shortcut .close:hover{background:url(/Public/images/close-demo.gif) no-repeat 0 -20px}
.shortcut .close:active{background:url(/Public/images/close-demo.gif) no-repeat 0 -40px}
</style>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var iframeHeight = function () {
var _height = $(window).height() - 34;
$('#content').height(_height);
}
window.onresize = iframeHeight;
$(function () {
iframeHeight();
});
});
</script>
<div id="container" style="overflow:hidden;">
<iframe border="0" id="content" src="js/index.html" frameborder="0" height="100%" width="100%" style="height: 577px;"></iframe>
</div>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F382f81c966395258f239157654081890' type='text/javascript'%3E%3C/script%3E"));
</script><script src="js/h.js" type="text/javascript"></script>
</body>
</html>
不知道这样的方式有没有吸引到你或者勾起你怎样的联想呢?
(ps:源码只做出了效果,并没有进过美工处理)