Html
    Css
    Js

    
                        
* {
	margin:0;
	padding:0;
	font-family:"微软雅黑";
	list-style:none;
	color:#666;
	text-decoration:none;
	font-size:14px;
}
body {
	background:#f5f5f5;
}
.hid {
	overflow:hidden;
}
.left {
	float:left;
}
#box {
	width:978px;
	margin:20px auto;
}
#box ul {
	margin-right:-14px;
	overflow:hidden;
}
#box li {
	width:234px;
	float:left;
	margin-right:14px;
	padding:34px 0 20px;
	background:#FFF;
	text-align:center;
	position:relative;
	cursor:pointer;
	margin-bottom:14px;
}
.pro_img {
	width:150px;
	height:150px;
	margin:0 auto 18px;
}
.pro_name {
	display:block;
	text-overflow:ellipsis;
	white-space:nowrap;
	overflow:hidden;
	font-weight:400;
}
.pro_name a {
	color:#333;
}
.pro_price {
	color:#ff6700;
	margin:0 10px 10px;
}
.pro_rank {
	color:#b0b0b0;
}
#box li:hover .add_btn {
	display:block;
}
.add_btn {
	background:#ff6700;
	height:66px;
	position:absolute;
	width:100%;
	bottom:0;
	left:0;
	line-height:66px;
	display:none;
	color:#FFF;
	font-size:20px;
}
.car {
	width:978px;
	margin:20px auto;
	background:#FFF;
}
.car .img {
	width:190px;
}
.car .img img {
	display:block;
	width:80px;
	height:80px;
	margin:3px auto;
}
.car .name {
	width:350px;
}
.car .name span {
	line-height:1;
	margin-top:8px;
	margin-bottom:8px;
	font-size:18px;
	font-weight:normal;
	text-overflow:ellipsis;
	white-space:nowrap;
	overflow:hidden;
}
.car .price {
	width:144px;
	text-align:right;
	padding-right:84px;
}
.car .price span {
	color:#ff6700;
	font-size:16px;
}
.car .ctrl {
	width:175px;
	padding-right:25px;
	text-align:center;
}
.car .ctrl a {
	font-size:20px;
	cursor:pointer;
	display:block;
	width:26px;
	height:26px;
	margin:30px auto;
	line-height:26px;
}
.car .ctrl a:hover {
	color:#FFF;
	background:#ff6700;
}
.head_row {
	height:70px;
	line-height:70px;
}
.head_row,.row {
	border-bottom:solid 1px #e0e0e0;
}
.row {
	height:86px;
	line-height:86px;
	padding:15px 0;
}

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

js添加购物车

1
      bill0
      2017/6/19 12:31:05
      显示感谢一下楼主,不过有一点不好,那就是购买相同的商品的时候并不是用1 2 3 这样子的来表示,而是直接加到下面去 回复