base.css
common.css
index.html
index.css
list.html
list.css
phone detail.html
phone detail.css
register.html
register.css
index.js
phone detail.js
animate.js
jQuery.min.js
shopCar.js
1、公共部分
base.css
* {
margin: 0;
padding: 0;
}
.w {
width: 1200px;
margin: 0 auto;
}
a {
text-decoration: none;
color: #666;
}
a:hover {
color: #e33333;
}
li {
list-style: none;
}
em,
i {
font-style: normal;
}
button {
cursor: pointer;
}
button,
input {
font-family: 'Microsoft YaHei', 'Heiti SC', tahoma, arial, 'Hiragino Sans GB', \\5B8B\4F53, sans-serif;
outline: none;
}
body {
background-color: #fff;
font: 12px/1.5 'Microsoft YaHei', 'Heiti SC', tahoma, arial, 'Hiragino Sans GB', \\5B8B\4F53, sans-serif;
color: #666 /* 使所有body中的字体为12px(除了一些在CSS中被规定大小了的字体)、1.5倍行高,颜色为#666 */
}
.clearfix:after {
visibility: hidden;
clear: both;
display: block;
content: ".";
height: 0
}
.clearfix {
*zoom: 1
}
common.css
@font-face {
font-family: 'icomoon';
src: url('../fonts/icomoon.eot?7kkyc2');
src: url('../fonts/icomoon.eot?7kkyc2#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf?7kkyc2') format('truetype'),
url('../fonts/icomoon.woff?7kkyc2') format('woff'),
url('../fonts/icomoon.svg?7kkyc2#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
/* shoutcut start */
.fl {
float: left;
}
.fr {
float: right;
}
.fr .icomoon {
font-family: 'icomoon';
font-size: 16px;
line-height: 26px;
}
.style-red {
color: #c81623;
}
.spacer {
width: 1px;
height: 12px;
line-height: 12px;
background-color: #666;
margin: 12px;
}
.shortcut {
width: 100%;
height: 35px;
line-height: 35px;
background-color: #f1f1f1;
}
.shortcut li {
float: left;
}
/* shoutcut end */
/* header start */
.header {
position: relative;
width: 95%;
height: 105px;
}
.logo a {
display: block;
position: absolute;
top: 25px;
left: 0;
width: 175px;
height: 56px;
background: url(../images/logo.png) no-repeat;
font-size: 0;
}
.search {
/* 父级可不加宽高 */
position: absolute;
top: 25px;
left: 348px;
}
.text {
float: left;
width: 445px;
height: 32px;
border: 2px solid #b1191a;
padding-left: 10px;
color: #ccc;
}
.btn {
float: left;
width: 82px;
height: 36px;
background-color: #b1191a;
border: 0;
font-size: 16px;
color: #fff;
}
.hotwords {
position: absolute;
top: 60px;
left: 340px;
}
.hotwords a {
margin: 0 9px;
}
.shopcar {
position: absolute;
top:25px;
right: 65px;
width: 140px;
height: 35px;
border: 1px solid #dfdfdf;
background-color: #f7f7f7;
line-height: 35px;
text-align: center;
cursor: pointer;
}
.car {
font-family: 'icomoon';
margin-right: 5px;
color: #da5555;
}
.arrow {
font-family: 'icomoon';
margin-left: 5px;
}
.count {
position: absolute;
top: -5px;
left: 100px;
height: 14px;
padding: 0 3px;
line-height: 14px;
border-radius: 7px 7px 7px 0;
background-color: #e60012;
color: #fff;
}
/* header end */
/* nav start */
.nav {
width: 100%;
height: 45px;
border-bottom: 2px solid #b1191a;
}
.dropdown {
position: relative;
}
.dropdown .dt{
width: 215px;
height: 45px;
line-height: 45px;
text-align: center;
font-size: 16px;
background-color: #b1191a;
color: #fff;
cursor: pointer;
}
.dropdown .dd {
position: absolute;
display: none;
overflow: hidden;
top: 45px;
left: 0;
width: 215px;
height: 525px;
margin-top: 2px;
z-index: 0;
border-bottom: 1px solid #c81623;
background-color: #c81623;
}
.menu_item {
width: 100%;
height: 35px;
padding: 0 15px;
line-height: 35px;
transition: all .3s; /* 过渡动画 */
}
.menu_item:hover {
width: 180px;
background-color: #fff;
padding-left: 20px;
}
.menu_item a {
font-size: 14px;
color: #fff;
}
.menu_item:hover a {
color: #c81623;
}
.menu_item i {
float: right;
font-family: 'icomoon';
padding-right: 25px;
font-size: 18px;
color: #fff;
}
.navitems li {
float: left;
}
.navitems li a {
display: block;
width: 100px;
height: 45px;
line-height: 45px;
text-align: center;
font-size: 16px;
transition: all .3s;
}
.navitems li a:hover {
font-size: 18px;
background-color: #c81623;
color: #fff;
}
/* nav end */
/* content start */
/* content end */
/* footer start */
footer {
width: 100%;
height: 385px;
padding-top: 30px;
background-color: #f5f5f5;
}
/* 第一层 */
.ser {
height: 79px;
border-bottom: 1px solid #ccc;
}
.ser li {
float: left;
width: 240px;
height: 100%;
}
.ser-icon {
float: left;
width: 50px;
height: 50px;
margin-left: 35px;
background: url(../images/icons.png) no-repeat;
}
.ser-circle1 {
background-position: -253px -3px;
}
.ser-circle2 {
background-position: -255px -54px;
}
.ser-circle3 {
background-position: -257px -106px;
}
.ser-circle4 {
background-position: -258px -156px;
}
.ser-circle5 {
background-position: -257px -209px;
}
.ser-title {
float: left;
margin-left: 5px;
}
.ser-title h5 {
margin-top: 7px;
font-size: 11px;
}
/* 第二层 */
.help {
width: 100%;
height: 190px;
border-bottom: 1px solid #ccc;
}
.help-item {
float: left;
width: 150px;
padding: 20px 0 0 50px;
}
.help-item dt {
width: 100%;
height: 25px;
font-size: 16px;
}
.help-item dd {
width: 100%;
height: 22px;
}
.help-app dt,
.help-app p {
padding-left: 15px;
}
.help-app img {
margin: 7px 0;
}
/* 第三层 */
.cr-links {
height: 36px;
line-height: 36px;
padding-left: 225px;
}
.cr-links li {
float: left;
}
.cr-spacer {
width: 1px;
height: 12px;
margin: 14px 8px 12px;
background-color: #666;
}
.copyright-info {
display: inline-block;
width: 100%;
text-align: center;
}
/* footer end */
2、首页
index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>品优购title>
<meta name="Keywords" content="网上购物,网上商城,手机,笔记本,
电脑,MP3,CD,VCD,DV,相机,数码,配件,手表,存储卡,品优购"/>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="../css/base.css">
<link rel="stylesheet" href="../css/common.css">
<link rel="stylesheet" href="../css/list.css">
<link rel="stylesheet" href="../css/index.css">
<script src="../js/animate.js">script>
<script src="../js/index.js">script>
head>
<body>
<header class="shortcut">
<div class="w">
<div class="fl">
<ul class="clearfix">
<li>品优购欢迎您!li>
<li class="login">
<a href="javascript:;">请登录a>
<a href="register.html" target="_blank" class="style-red">免费注册a>
li>
ul>
div>
<div class="fr">
<ul>
<li><a href="javascript:;">我的订单a>li>
<li class="spacer">li>
<li>
<a href="javascript:;">我的品优购a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li><a href="javascript:;">品优购会员a>li>
<li class="spacer">li>
<li><a href="javascript:;">企业采购a>li>
<li class="spacer">li>
<li>
<a href="javascript:;">关注品优购a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li>
<a href="javascript:;">客户服务a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li>
<a href="javascript:;">网站导航a>
<i class="icomoon">i>
li>
ul>
div>
div>
header>
<div class="header w">
<div class="logo">
<h1><a href="index.html" title="品优购">品优购a>h1>
div>
<div class="search">
<input type="text" class="text" placeholder="请输入内容">
<button class="btn">搜索button>
div>
<div class="hotwords">
<a href="javascript:;">优惠购首发a>
<a href="javascript:;">亿元优惠a>
<a href="javascript:;">9.9元团购a>
<a href="javascript:;">美满99减30a>
<a href="javascript:;">办公用品a>
<a href="javascript:;">电脑a>
<a href="javascript:;">通信a>
div>
<div class="shopcar">
<i class="car">i>
<span>我的购物车span>
<i class="arrow">i>
<i class="count">80i>
div>
div>
<div class="nav">
<div class="w">
<div class="dropdown fl">
<div class="dt">全部商品分类div>
<div class="dd" style="display: block;">
<ul>
<li class="menu_item"><a href="#">家用电器a><i>i>li>
<li class="menu_item"><a href="list.html" target="_blank">手机、数码、通信a><i>i>li>
<li class="menu_item"><a href="#">电脑、办公a><i>i>li>
<li class="menu_item"><a href="#">家具、厨具a><i>i>li>
<li class="menu_item"><a href="#">男装、女装、童装a><i>i>li>
<li class="menu_item"><a href="#">化妆品、清洁用品a><i>i>li>
<li class="menu_item"><a href="#">箱包、珠宝a><i>i>li>
<li class="menu_item"><a href="#">汽车用品a><i>i>li>
<li class="menu_item"><a href="#">乐器a><i>i>li>
<li class="menu_item"><a href="#">母婴、玩具a><i>i>li>
<li class="menu_item"><a href="#">食品、酒类、生鲜a><i>i>li>
<li class="menu_item"><a href="#">医药保健a><i>i>li>
<li class="menu_item"><a href="#">图书、音像、电子书a><i>i>li>
<li class="menu_item"><a href="#">彩票、充值、票务a><i>i>li>
<li class="menu_item"><a href="#">理财、众筹a><i>i>li>
div>
div>
<div class="navitems fl">
<ul>
<li><a href="#">服装城a>li>
<li><a href="#">美妆馆a>li>
<li><a href="#">传智超市a>li>
<li><a href="#">全球购a>li>
<li><a href="#">闪购a>li>
<li><a href="#">团购a>li>
<li><a href="#">拍卖a>li>
<li><a href="#">有趣a>li>
ul>
div>
div>
div>
<div class="w">
<div class="main">
<div class="focus fl">
<a href="javascript:;" class="arrow-l"><a>
<a href="javascript:;" class="arrow-r">>a>
<ul>
<li>
<a href="#"><img src="../upload/focus.jpg" alt="">a>
li>
<li>
<a href="#"><img src="../upload/focus1.jpg" alt="">a>
li>
<li>
<a href="#"><img src="../upload/focus2.jpg" alt="">a>
li>
<li>
<a href="#"><img src="../upload/focu3.jpg" alt="">a>
li>
ul>
<ol class="circle">ol>
div>
<div class="newsflash">
<div class="news">
<div class="news-hd">
<h5>品优购快报h5>
<a href="#" class="index-more">更多a>
div>
<div class="news-bd">
<ul>
<li><a href="#"><strong class="style-red">[重磅]strong>它来了它来了,pink老师走来了, 它是谁?a>li>
<li><a href="#"><strong class="style-red">[重磅]strong>它来了它来了,pink老师走来了a>li>
<li><a href="#"><strong class="style-red">[重磅]strong>它来了它来了,pink老师走来了a>li>
<li><a href="#"><strong class="style-red">[重磅]strong>它来了它来了,pink老师走来了a>li>
<li><a href="#"><strong class="style-red">[重磅]strong>它来了它来了,pink老师走来了, 它是谁?a>li>
ul>
div>
div>
<div class="life-ser">
<ul>
<li>
<i class="ser1">i>
<p>话费p>
li>
<li>
<i class="ser2">i>
<p>机票p>
li>
<li>
<i class="ser3">i>
<p>电影p>
li>
<li>
<i class="ser4">i>
<p>游戏p>
li>
<li>
<i class="ser5">i>
<p>彩票p>
li>
<li>
<i class="ser6">i>
<p>油费p>
li>
<li>
<i class="ser7">i>
<p>订房p>
li>
<li>
<i class="ser8">i>
<p>火车票p>
li>
<li>
<i class="ser9">i>
<p>贷款p>
li>
<li>
<i class="ser10">i>
<p>货币p>
li>
<li>
<i class="ser11">i>
<p>信用卡p>
li>
<li>
<i class="ser12">i>
<p>书籍p>
li>
ul>
div>
<div>
<img src="../upload/bargain.jpg" id="bargain">
div>
div>
div>
div>
<footer>
<div class="w">
<div class="ser">
<ul>
<li>
<i class="ser-icon ser-circle1">i>
<div class=ser-title>
<h5>正品保证h5>
<p>正品保证,提供发票p>
div>
li>
<li>
<i class="ser-icon ser-circle2">i>
<div class=ser-title>
<h5>物流保障h5>
<p>物流保障,及时信息p>
div>
li>
<li>
<i class="ser-icon ser-circle3">i>
<div class=ser-title>
<h5>运货保险h5>
<p>运货保险,方便退货p>
div>
li>
<li>
<i class="ser-icon ser-circle4">i>
<div class=ser-title>
<h5>售后服务h5>
<p>售后服务,全心全意p>
div>
li>
<li>
<i class="ser-icon ser-circle5">i>
<div class=ser-title>
<h5>寻求帮助h5>
<p>寻求帮助,排忧解难p>
div>
li>
ul>
div>
<div class="help">
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item help-app">
<dt>帮助中心dt>
<dd>
<img src="../upload/erweima.png" alt="">
<p>品优购客户端p>
dd>
dl>
div>
<div class="copyright">
<div class="cr-links">
<ul>
<li><a href="javascript:;">关于我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系客服a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">商家入驻a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">营销中心a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">手机品优购a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">友情链接a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">销售联盟a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购社区a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购公益a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">English Sitea>li>
ul>
div>
<p class="copyright-info">
地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn <br> 京ICP备08001421号京公网安备110108007702
p>
div>
div>
footer>
body>
html>
index.css
/* main start */
.main {
width: 980px;
height: 516px;
margin: 10px 0 0 220px;
}
.focus {
position: relative;
width: 720px;
height: 516px;
overflow: hidden;
}
.arrow-l,
.arrow-r {
position: absolute;
top: 50%;
z-index: 1;
display: none;
width: 24px;
height: 50px;
margin-top: -20px;
line-height: 50px;
text-align: center;
font-size: 18px;
background: rgba(0, 0, 0, .3);
color: #fff;
}
.arrow-r {
right: 0;
}
.focus ul {
position: absolute;
top: 0;
left: 0;
width: 600%;
overflow: hidden;
}
.focus img{
float: left;
width: 720px;
height: 516px;
}
.focus li {
float: left;
}
.circle {
position: absolute;
bottom: 10px;
left: 47%;
}
.circle li {
float: left;
width: 8px;
height: 8px;
margin: 0 3px;
border: 2px solid rgba(255, 255, 255, 0.5);
border-radius: 50%;
cursor: pointer;
}
.current {
background-color: #fff;
}
.newsflash {
float: right;
width: 250px;
height: 516px;
}
.news {
height: 200px;
border: 1px solid #e4e4e4;
}
.news-hd {
height: 40px;
line-height: 40px;
border-bottom: 1px dotted #e4e4e4;
padding: 0 15px;
}
.news-hd h5 {
float: left;
font-size: 14px;
}
.index-more {
float: right;
}
.index-more::after {
font-family: 'icomoon';
content: '\e920';
}
.news-bd {
padding: 5px 15px 0;
font-size: 14px;
}
.news-bd ul li {
height: 30px;
line-height: 30px;
/* 以下3者构成超出部分的文本以省略号形式呈现 */
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.life-ser {
width: 248px;
height: 233px;
border: 1px solid #e4e4e4;
border-top: 0;
}
.life-ser ul li {
float: left;
width: 61px;
height: 77px;
text-align: center;
border-right: 1px solid #e4e4e4;
border-bottom: 1px solid #e4e4e4;
cursor: pointer;
}
.life-ser ul li:nth-child(4n) {
border-right: 0;
}
.life-ser ul li i {
display: inline-block;
width: 35px;
height: 30px;
margin-top: 12px;
background: url(../images/icons.png) no-repeat;
}
.life-ser .ser1 {
background-position: -10px -15px;
}
.life-ser .ser2 {
background-position: -74px -15px;
}
.life-ser .ser3 {
background-position: -136px -15px;
}
.life-ser .ser4 {
background-position: -200px -15px;
}
.life-ser .ser5 {
background-position: -11px -87px;
}
.life-ser .ser6 {
background-position: -74px -87px;
}
.life-ser .ser7 {
background-position: -136px -87px;
}
.life-ser .ser8 {
background-position: -200px -87px;
}
.life-ser .ser9 {
background-position: -12px -158px;
}
.life-ser .ser10 {
background-position: -74px -158px;
}
.life-ser .ser11 {
background-position: -136px -154px;
}
.life-ser .ser12 {
background-position: -200px -158px;
}
#bargain {
width: 100%;
height: 75px;
margin-top: 5px;
cursor: pointer;
}
/* main end */
3、手机列表页
list.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>手机列表页title>
<meta name="Keywords" content="网上购物,网上商城,手机,笔记本,
电脑,MP3,CD,VCD,DV,相机,数码,配件,手表,存储卡,品优购"/>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="../css/base.css">
<link rel="stylesheet" href="../css/common.css">
<link rel="stylesheet" href="../css/list.css">
<script src="../js/phone detail.js">script>
head>
<body>
<header class="shortcut">
<div class="w">
<div class="fl">
<ul class="clearfix">
<li>品优购欢迎您!li>
<li class="login">
<a href="javascript:;">请登录a>
<a href="register.html" class="style-red">免费注册a>
li>
ul>
div>
<div class="fr">
<ul>
<li><a href="javascript:;">我的订单a>li>
<li class="spacer">li>
<li>
<a href="javascript:;">我的品优购a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li><a href="javascript:;">品优购会员a>li>
<li class="spacer">li>
<li><a href="javascript:;">企业采购a>li>
<li class="spacer">li>
<li>
<a href="javascript:;">关注品优购a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li>
<a href="javascript:;">客户服务a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li>
<a href="javascript:;">网站导航a>
<i class="icomoon">i>
li>
ul>
div>
div>
header>
<div class="header w">
<div class="logo">
<h1><a href="index.html" title="品优购">品优购a>h1>
div>
<div class="search">
<input type="text" class="text" placeholder="请输入内容">
<button class="btn">搜索button>
div>
<div class="hotwords">
<a href="javascript:;">优惠购首发a>
<a href="javascript:;">亿元优惠a>
<a href="javascript:;">9.9元团购a>
<a href="javascript:;">美满99减30a>
<a href="javascript:;">办公用品a>
<a href="javascript:;">电脑a>
<a href="javascript:;">通信a>
div>
<div class="shopcar">
<i class="car">i>
<span>我的购物车span>
<i class="arrow">i>
<i class="count">80i>
div>
div>
<div class="nav">
<div class="w">
<div class="dropdown fl">
<div class="dt">全部商品分类div>
<div class="dd">
<ul>
<li class="menu_item"><a href="#">家用电器a><i>i>li>
<li class="menu_item"><a href="list.html">手机、数码、通信a><i>i>li>
<li class="menu_item"><a href="#">电脑、办公a><i>i>li>
<li class="menu_item"><a href="#">家具、厨具a><i>i>li>
<li class="menu_item"><a href="#">男装、女装、童装a><i>i>li>
<li class="menu_item"><a href="#">化妆品、清洁用品a><i>i>li>
<li class="menu_item"><a href="#">箱包、珠宝a><i>i>li>
<li class="menu_item"><a href="#">汽车用品a><i>i>li>
<li class="menu_item"><a href="#">乐器a><i>i>li>
<li class="menu_item"><a href="#">母婴、玩具a><i>i>li>
<li class="menu_item"><a href="#">食品、酒类、生鲜a><i>i>li>
<li class="menu_item"><a href="#">医药保健a><i>i>li>
<li class="menu_item"><a href="#">图书、音像、电子书a><i>i>li>
<li class="menu_item"><a href="#">彩票、充值、票务a><i>i>li>
<li class="menu_item"><a href="#">理财、众筹a><i>i>li>
div>
div>
<div class="navitems fl">
<ul>
<li><a href="#">服装城a>li>
<li><a href="#">美妆馆a>li>
<li><a href="#">传智超市a>li>
<li><a href="#">全球购a>li>
<li><a href="#">闪购a>li>
<li><a href="#">团购a>li>
<li><a href="#">拍卖a>li>
<li><a href="#">有趣a>li>
ul>
div>
div>
div>
<div class="list-con w">
<div class="list-hd">
<img src="../upload/bg_03.png" alt="">
div>
<div class="list-bd clearfix">
<ul>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
<li>
<a href="phone detail.html" target="_blank"><img src="../upload/mobile.jpg" alt="">a>
<div class="iPhone-info">
<a href="phone detail.html" target="_blank">
<p>iPhone 6S Plus(A1699) 32G 玫瑰金 移动/联通/电信4G手机p>
a>
<div class="show-price">
<i class="cut-price">¥6088i>
<i class="list-price">¥6988i>
div>
<div class="info-bottom">
<div class="sold">已售87%div>
<div class="bar">
<div class="inner-bar">div>
div>
<div class="remain">剩余<i class="style-red">29i>件div>
div>
div>
<a href="phone detail.html" target="_blank" class="buy">立即抢购a>
li>
ul>
div>
div>
div>
<footer>
<div class="w">
<div class="ser">
<ul>
<li>
<i class="ser-icon ser-circle1">i>
<div class=ser-title>
<h5>正品保证h5>
<p>正品保证,提供发票p>
div>
li>
<li>
<i class="ser-icon ser-circle2">i>
<div class=ser-title>
<h5>物流保障h5>
<p>物流保障,及时信息p>
div>
li>
<li>
<i class="ser-icon ser-circle3">i>
<div class=ser-title>
<h5>运货保险h5>
<p>运货保险,方便退货p>
div>
li>
<li>
<i class="ser-icon ser-circle4">i>
<div class=ser-title>
<h5>售后服务h5>
<p>售后服务,全心全意p>
div>
li>
<li>
<i class="ser-icon ser-circle5">i>
<div class=ser-title>
<h5>寻求帮助h5>
<p>寻求帮助,排忧解难p>
div>
li>
ul>
div>
<div class="help">
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item help-app">
<dt>帮助中心dt>
<dd>
<img src="../upload/erweima.png" alt="">
<p>品优购客户端p>
dd>
dl>
div>
<div class="copyright">
<div class="cr-links">
<ul>
<li><a href="javascript:;">关于我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系客服a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">商家入驻a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">营销中心a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">手机品优购a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">友情链接a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">销售联盟a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购社区a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购公益a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">English Sitea>li>
ul>
div>
<p class="copyright-info">
地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn <br> 京ICP备08001421号京公网安备110108007702
p>
div>
div>
footer>
body>
html>
list.css
.list-bd ul li {
float: left;
width: 283px;
height: 440px;
margin-right: 22.5px;
}
.list-bd ul li:nth-child(4n) {
margin-right: 0;
}
.iPhone-info {
padding: 0 10px;
}
.show-price {
margin: 5px 0;
}
.cut-price {
font-size: 20px;
font-weight: 700;
color: #c81623;
}
.list-price {
padding-left: 5px;
text-decoration: line-through;
}
.info-bottom {
height: 20px;
line-height: 20px;
color: #000;
}
.sold,
.bar {
float: left;
}
.remain {
float: right;
}
.bar {
width: 150px;
height: 14px;
margin: 3px 4px;
border-radius: 7px;
background-color: #fff;
}
.inner-bar {
width: 130px;
height: 14px;
border-radius: 7px 0 0 7px;
background-color: #c81623;
}
.buy {
display: block;
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
margin-top: 10px;
background-color: #c81623;
font-size: 18px;
font-weight: 700;
color: #fff;
}
.buy:hover {
color: #fff;
}
4、手机详情页
iPhone detail.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>手机详情页title>
<meta name="Keywords" content="网上购物,网上商城,手机,笔记本,
电脑,MP3,CD,VCD,DV,相机,数码,配件,手表,存储卡,品优购"/>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="../css/base.css">
<link rel="stylesheet" href="../css/common.css">
<link rel="stylesheet" href="../css/phone detail.css">
<script src="../js/phone detail.js">script>
head>
<body>
<header class="shortcut">
<div class="w">
<div class="fl">
<ul>
<li>品优购欢迎您!li>
<li class="login">
<a href="javascript:;">请登录a>
<a href="register.html" target="_blank" class="style-red">免费注册a>
li>
ul>
div>
<div class="fr">
<ul>
<li><a href="javascript:;">我的订单a>li>
<li class="spacer">li>
<li>
<a href="javascript:;">我的品优购a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li><a href="javascript:;">品优购会员a>li>
<li class="spacer">li>
<li><a href="javascript:;">企业采购a>li>
<li class="spacer">li>
<li>
<a href="javascript:;">关注品优购a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li>
<a href="javascript:;">客户服务a>
<i class="icomoon">i>
li>
<li class="spacer">li>
<li>
<a href="javascript:;">网站导航a>
<i class="icomoon">i>
li>
ul>
div>
div>
header>
<div class="header w">
<div class="logo">
<h1><a href="index.html" title="品优购">品优购a>h1>
div>
<div class="search">
<input type="text" class="text" placeholder="请输入内容">
<button class="btn">搜索button>
div>
<div class="hotwords">
<a href="javascript:;">优惠购首发a>
<a href="javascript:;">亿元优惠a>
<a href="javascript:;">9.9元团购a>
<a href="javascript:;">美满99减30a>
<a href="javascript:;">办公用品a>
<a href="javascript:;">电脑a>
<a href="javascript:;">通信a>
div>
<div class="shopcar">
<i class="car">i>
<span>我的购物车span>
<i class="arrow">i>
<i class="count">80i>
div>
div>
<div class="nav">
<div class="w">
<div class="dropdown fl">
<div class="dt">全部商品分类div>
<div class="dd">
<ul>
<li class="menu_item"><a href="#">家用电器a><i>i>li>
<li class="menu_item"><a href="list.html" target="_blank">手机、数码、通信a><i>i>li>
<li class="menu_item"><a href="#">电脑、办公a><i>i>li>
<li class="menu_item"><a href="#">家具、厨具a><i>i>li>
<li class="menu_item"><a href="#">男装、女装、童装a><i>i>li>
<li class="menu_item"><a href="#">化妆品、清洁用品a><i>i>li>
<li class="menu_item"><a href="#">箱包、珠宝a><i>i>li>
<li class="menu_item"><a href="#">汽车用品a><i>i>li>
<li class="menu_item"><a href="#">乐器a><i>i>li>
<li class="menu_item"><a href="#">母婴、玩具a><i>i>li>
<li class="menu_item"><a href="#">食品、酒类、生鲜a><i>i>li>
<li class="menu_item"><a href="#">医药保健a><i>i>li>
<li class="menu_item"><a href="#">图书、音像、电子书a><i>i>li>
<li class="menu_item"><a href="#">彩票、充值、票务a><i>i>li>
<li class="menu_item"><a href="#">理财、众筹a><i>i>li>
div>
div>
<div class="navitems fl">
<ul>
<li><a href="#">服装城a>li>
<li><a href="#">美妆馆a>li>
<li><a href="#">传智超市a>li>
<li><a href="#">全球购a>li>
<li><a href="#">闪购a>li>
<li><a href="#">团购a>li>
<li><a href="#">拍卖a>li>
<li><a href="#">有趣a>li>
ul>
div>
div>
div>
<div class="cont w">
<div class="wrap">
<a href="#">手机、数码、通讯a> >
<a href="#">手机a> >
<a href="#">苹果a> >
<a href="#">iphone 6S Plusa>
div>
<div class="pro-intro clearfix">
<div class="preview fl">
<div class="pre-img">
<img src="../upload/s3.png" alt="">
<div class="mask">div>
<div class="big">
<img src="../upload/big.jpg" alt="" class="bigImg">
div>
div>
<div class="pre-list">
<a href="#" class="arrow-prev">a>
<a href="#" class="arrow-next">a>
<ul class="list-item">
<li><img src="../upload/pre.jpg" alt="">li>
<li><img src="../upload/pre.jpg" alt="">li>
<li><img src="../upload/pre.jpg" alt="">li>
<li><img src="../upload/pre.jpg" alt="">li>
<li><img src="../upload/pre.jpg" alt="">li>
ul>
div>
div>
<div class="item-info fr">
<div class="phone-name">iPhone 6S(A1700) 64G 玫瑰金 移动/通信/电信4G手机div>
<div class="deco">推荐下方选择[移动优惠购]:手机套餐齐搞定,不换号,每月返话费div>
<dl class="summary">
<dl class="sum-price">
<dt>价格dt>
<dd>
<i class="price">¥5299.00i>
<a href="#" class="price-cut">降价通知a>
<div class="remark">
<i>累计评价:i>
<a href="#">612188a>
div>
dd>
dl>
<dl class="sum-pro">
<dt>促销dt>
<dd>
<em>加购价em>
<i>满999另加20元,满1999另加30元,满2999另加40元,即可在购物车换购热销商品i>
<a href="#">点击了解详情a>
dd>
dl>
<dl class="sum-sup">
<dt>支持dt>
<dd>以旧换新,闲置手机回收。4G套餐超值抢,礼品购dd>
dl>
<dl class="col-cho">
<dt>选择颜色dt>
<dd>
<a href="#">玫瑰金a>
<a href="#">金色a>
<a href="#">白色a>
<a href="#">土豪金a>
dd>
dl>
<dl class="ver-cho">
<dt>选择版本dt>
<dd>
<a href="#">公开版a>
<a href="#">移动4Ga>
dd>
dl>
<dl class="type-cho">
<dt>购买方式dt>
<dd>
<a href="#">官方标配a>
<a href="#">移动优惠购a>
<a href="#">电信优惠购a>
dd>
dl>
<div class="cho-btns">
<div class="cho-amo">
<input type="text" value="1">
<a href="#" class="add">+a>
<a href="#" class="reduce">-a>
div>
<a href="#" class="addcar">加入购物车a>
div>
div>
div>
div>
<div class="pro-detail w clearfix">
<div class="aside fl">
<div class="tab-list">
<ul>
<li class="tab1">相关分类li>
<li class="tab2">推荐品牌li>
ul>
div>
<div class="tab-con">
<ul>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li class="tab-con-list">
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
<li>
<img src="../upload/aside_img.jpg" alt="">
<h5>华为 HUAWEI P20 Pro 全面屏徕卡h5>
<div class="aside-price">¥19div>
<a href="#" class="as-addcar">加入购物车a>
li>
ul>
div>
div>
<div class="detail fr">
<div class="de-tab">
<ul>
<li><a href="#" class="a-first">商品介绍a>li>
<li><a href="#">规格与包装a>li>
<li><a href="#">售后保障a>li>
<li><a href="#">商品评价(50000)a>li>
<li><a href="#">手机社区a>li>
ul>
div>
<div class="de-tab-con">
<div class="de-item">
<ul class="de-info">
<li>分辨率:1920*1080(FHD)li>
<li>后置摄像头:1200万像素li>
<li>前置摄像头:500万像素li>
<li>核数:其他li>
<li>频率:以官网信息为准li>
<li>品牌:Apple ♥关注li>
<li>商品名称:APPLEiPhone 6s Plusli>
<li>商品编号:1861098li>
<li>商品毛重:0.51kgli>
<li>商品产地:中国大陆li>
<li>热点:指纹识别,Apple Pay,金属机身,拍照神器li>
<li>系统:苹果(IOS)li>
<li>像素:1000-1600万li>
<li>机身内存:64GBli>
ul>
<p><a href="#" class="more">查看更多参数a>p>
<img src="../upload/detail_img1.jpg" alt="" class="iPhone">
<img src="../upload/detail_img2.jpg" alt="" class="iPhone">
<img src="../upload/detail_img3.jpg" alt="" class="iPhone">
div>
div>
div>
div>
<footer>
<div class="w">
<div class="ser">
<ul>
<li>
<i class="ser-icon ser-circle1">i>
<div class=ser-title>
<h5>正品保证h5>
<p>正品保证,提供发票p>
div>
li>
<li>
<i class="ser-icon ser-circle2">i>
<div class=ser-title>
<h5>物流保障h5>
<p>物流保障,及时信息p>
div>
li>
<li>
<i class="ser-icon ser-circle3">i>
<div class=ser-title>
<h5>运货保险h5>
<p>运货保险,方便退货p>
div>
li>
<li>
<i class="ser-icon ser-circle4">i>
<div class=ser-title>
<h5>售后服务h5>
<p>售后服务,全心全意p>
div>
li>
<li>
<i class="ser-icon ser-circle5">i>
<div class=ser-title>
<h5>寻求帮助h5>
<p>寻求帮助,排忧解难p>
div>
li>
ul>
div>
<div class="help">
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item help-app">
<dt>帮助中心dt>
<dd>
<img src="../upload/erweima.png" alt="">
<p>品优购客户端p>
dd>
dl>
div>
<div class="copyright">
<div class="cr-links">
<ul>
<li><a href="javascript:;">关于我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系客服a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">商家入驻a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">营销中心a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">手机品优购a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">友情链接a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">销售联盟a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购社区a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购公益a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">English Sitea>li>
ul>
div>
<p class="copyright-info">
地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn <br> 京ICP备08001421号京公网安备110108007702
p>
div>
div>
footer>
body>
html>
phone detail. css
.cont {
margin-top: 20px;
}
/* title */
.wrap {
width: 100%;
height: 25px;
line-height: 25px;
}
.wrap a {
margin: 0 5px;
}
/* first part */
/* first part left */
.preview {
width: 400px;
height: 520px;
}
.pre-img {
position: relative;
height: 400px;
border: 1px solid #ccc;
}
.mask {
display: none;
position: absolute;
top: 0;
left: 0;
width: 300px;
height: 300px;
background-color: #FEDE4F;
opacity: .5;
border: 1px solid #ccc;
cursor: move;
}
.big {
display: none;
overflow: hidden; /* 图片大于"放大镜",需要截掉超出部分 */
position: absolute;
top: 0;
left: 400px;
width: 500px;
height: 500px;
background-color: lightblue;
z-index: 10;
border: 1px solid #ccc;
}
.big img {
position: absolute;
top: 0;
left: 0;
}
.pre-list {
position: relative;
width: 100%;
height: 60px;
margin-top: 30px;
}
.list-item {
width: 320px;
height: 60px;
margin: 0 auto;
}
.list-item li {
float: left;
width: 56px;
height: 56px;
border: 2px solid #fff;
margin: 0 2px;
cursor: pointer;
transition: all .5s;
}
.list-item li:hover {
border: 2px solid #e12228;
}
.arrow-prev,
.arrow-next {
position: absolute;
top: 15px;
width: 22px;
height: 32px;
}
.arrow-prev {
left: 0;
background: url(../images/arrow-prev.png) no-repeat;
}
.arrow-next {
right: 0;
background: url(../images/arrow-next.png) no-repeat;
}
/* first part right */
.item-info {
width: 718px;
}
.phone-name {
width: 100%;
height: 30px;
font-size: 16px;
font-weight: 700;
}
.deco {
width: 100%;
height: 32px;
color: #e12228;
}
.summary dl {
overflow: hidden;
}
.summary dt,
.summary dd {
float: left;
}
.summary dt {
width: 75px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
}
.sum-price,
.sum-pro {
position: relative;
width: 700px;
height: 40px;
line-height: 40px;
margin-bottom: 5px;
}
.price {
font-size: 24px;
color: #e12228;
}
.price-cut {
position: absolute;
top: 0;
left: 220px;
color: #c81623;
}
.remark {
position: absolute;
top: 0;
right: 20px;
font-size: 14px;
}
.remark i {
color: #000;
}
.sum-pro em {
display: inline-block;
width: 60px;
height: 35px;
margin: 3px 0;
line-height: 35px;
text-align: center;
font-size: 14px;
background-color: #c81623;
color: #fff;
}
.sum-pro i {
padding-left: 8px
}
.sum-pro a {
position: absolute;
top: 1px;
right: 20px;
color: #c81623;
}
.sum-sup {
line-height: 40px;
}
.col-cho a,
.ver-cho a,
.type-cho a {
display: inline-block;
width: 80px;
height: 30px;
margin: 4px 3px;
line-height: 30px;
text-align: center;
font-size: 14px;
background-color: #f7f7f7;
border: 1px solid #ededed;
transition: all .5s;
}
.col-cho a:hover,
.ver-cho a:hover,
.type-cho a:hover{
border: 1px solid #c81623;
background-color: #c81623;
color: #fff;
}
.cho-btns {
margin-top: 20px;
}
.cho-amo {
position: relative;
float: left;
width: 50px;
height: 45px;
background-color: pink;
}
.cho-amo input {
width: 35px;
height: 43px;
text-align: center;
border: 1px solid #ccc;
}
.add,
.reduce {
position: absolute;
right: 0;
width: 15px;
height: 22px;
line-height: 20px;
text-align: center;
font-size: 14px;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
.add {
top: 0;
}
.reduce {
bottom: 0;
cursor: not-allowed; /*禁止鼠标样式*/
}
.addcar {
float: left;
width: 140px;
height: 45px;
margin-left: 10px;
line-height: 45px;
text-align: center;
font-size: 18px;
font-weight: 700;
background-color: #c81623;
color: #fff;
}
.addcar:hover {
color: #fff;
}
/* second part left */
.aside {
width: 210px;
border: 1px solid #ccc;
}
.tab-list {
height: 34px;
}
.tab-list li {
float: left;
height: 35px;
line-height: 35px;
text-align: center;
background-color: #f1f1f1;
border-bottom: 1px solid #ccc;
}
.tab1,
.tab2 {
width: 104px;
border-left: 1px solid #ccc;
border-bottom: 1px solid #ccc;
transition: all .3s;
cursor: pointer;
}
.tab1:hover,
.tab2:hover {
border-bottom: 1px solid #fff;
background-color: #fff;
}
.tab-con {
padding: 0 10px;
}
.tab-con-list {
border-bottom: 1px solid #ccc;
}
.tab-con li h5 {
margin-left: 15px;
white-space: nowrap; /* 文本不进行换行 */
overflow: hidden;
text-overflow: ellipsis; /* 超出的文字省略号显示 */
font-weight: 400;
}
.aside-price {
display: inline-block;
font-weight: 700;
margin: 10px 27px;
}
.as-addcar {
display: inline-block;
width: 88px;
height: 26px;
line-height: 26px;
text-align: center;
border: 1px solid #ccc;
background-color: #f7f7f7;
transition: all .5s;
}
.as-addcar:hover {
color: #fff;
border: 1px solid #c81623;
background-color: #c81623;
}
/* second part right */
.detail {
width: 981px;
}
.de-tab {
height: 35px;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
.de-tab a {
float: left;
width: 195px;
height: 35px;
line-height: 35px;
text-align: center;
font-size: 16px;
border-left: 1px solid #ccc;
transition: all .5s;
cursor: pointer;
}
.de-tab .a-first {
border-left: 0;
}
.de-tab a:hover {
background-color: #c81623;
color: #fff;
}
.de-info {
padding: 14px 0 0 20px;
}
.de-info li {
line-height: 22px;
}
.more {
float: right;
margin: 20px;
font-size: 14px;
font-weight: 700;
font-family: 'icomoon';
}
.iPhone {
margin-top: 28px;
}
5、注册页
register.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>个人注册title>
<link rel="shortcut icon" href="../favicon.ico" />
<link rel="stylesheet" href="../css/base.css">
<link rel="stylesheet" href="../css/common.css">
<link rel="stylesheet" href="../css/register.css">
head>
<body>
<div class="w clearfix">
<header>
<div class="logo">
<a href="index.html"><img src="../images/logo.png" alt="">a>
div>
header>
<div class="reg-area">
<h3>注册新用户
<div class="acc-login">我有账号,去<a href="#">登陆a>div>
h3>
<div class="reg-form">
<form action="">
<ul>
<li>
<label>手机号:label>
<input type="text" class="inp">
<span class="error">
<i class="err-icon">i>
手机号码格式不正确,请从新输入
span>
li>
<li>
<label>短信验证码:label>
<input type="text" class="inp">
<span class="success">
<i class="suc-icon">i>
短信验证码输入正确
span>
li>
<li><label>登录密码:label>
<input type="password" class="inp">
<span class="error">
<i class="err-icon">i>
手机号码格式不正确,请从新输入
span>
li>
<li class="safe">
<i>安全程度i>
<em class="easy">弱em>
<em class="normal">中em>
<em class="hard">强em>
li>
<li>
<label>确认密码:label>
<input type="password" class="inp">
<span class="error">
<i class="err-icon">i>
手机号码格式不正确,请从新输入
span>
li>
<li class="agree">
<span class="agree-left">
<input type="checkbox" id="cb">同意协议并注册
<a href="#">《知晓用户协议》a>
span>
<input type="submit" value="完成注册" class="agree-right">
li>
ul>
form>
div>
div>
div>
<footer>
<div class="w">
<div class="ser">
<ul>
<li>
<i class="ser-icon ser-circle1">i>
<div class=ser-title>
<h5>正品保证h5>
<p>正品保证,提供发票p>
div>
li>
<li>
<i class="ser-icon ser-circle2">i>
<div class=ser-title>
<h5>物流保障h5>
<p>物流保障,及时信息p>
div>
li>
<li>
<i class="ser-icon ser-circle3">i>
<div class=ser-title>
<h5>运货保险h5>
<p>运货保险,方便退货p>
div>
li>
<li>
<i class="ser-icon ser-circle4">i>
<div class=ser-title>
<h5>售后服务h5>
<p>售后服务,全心全意p>
div>
li>
<li>
<i class="ser-icon ser-circle5">i>
<div class=ser-title>
<h5>寻求帮助h5>
<p>寻求帮助,排忧解难p>
div>
li>
ul>
div>
<div class="help">
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item">
<dt>购物指南dt>
<dd><a href="javascript:;">购物流程a>dd>
<dd><a href="javascript:;">会员介绍a>dd>
<dd><a href="javascript:;">生活旅行/团购a>dd>
<dd><a href="javascript:;">常见问题a>dd>
<dd><a href="javascript:;">大家电a>dd>
<dd><a href="javascript:;">联系客服a>dd>
dl>
<dl class="help-item help-app">
<dt>帮助中心dt>
<dd>
<img src="../upload/erweima.png" alt="">
<p>品优购客户端p>
dd>
dl>
div>
<div class="copyright">
<div class="cr-links">
<ul>
<li><a href="javascript:;">关于我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系我们a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">联系客服a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">商家入驻a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">营销中心a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">手机品优购a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">友情链接a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">销售联盟a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购社区a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">品优购公益a>li>
<li class="cr-spacer">li>
<li><a href="javascript:;">English Sitea>li>
ul>
div>
<p class="copyright-info">
地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn <br> 京ICP备08001421号京公网安备110108007702
p>
div>
div>
footer>
body>
register.css
header {
height: 84px;
border-bottom: 2px solid #c81523;
}
.logo a {
margin-left: 30px;
}
.reg-area {
height: 480px;
margin-top: 20px;
}
.reg-area h3 {
height: 40px;
line-height: 40px;
padding: 0 20px;
font-size: 18px;
font-weight: 400;
border: 1px solid #ccc;
background-color: #ececec;
}
.acc-login {
float: right;
font-size: 14px;
}
.acc-login a {
color: #c81523;
}
.reg-form {
width: 600px;
margin: 50px auto;
}
.reg-form ul li {
margin-bottom: 15px;
height: 32px;
line-height: 32px;
}
.reg-form ul li:nth-child(3) {
margin-bottom: 5px; /* 第3个 */
}
.reg-form ul li label {
display: inline-block;
width: 90px;
text-align: right;
font-size: 14px;
}
.inp {
width: 240px;
height: 30px;
text-indent: 5px;
border: 1px solid #ccc;
}
.error {
color: #c81523;
}
.success {
color: green;
}
.err-icon,
.suc-icon {
display: inline-block;
width: 20px;
height: 20px;
margin-top: -4px;
vertical-align: middle;
background: url(../images/error.png) no-repeat;
}
.suc-icon {
background: url(../images/success.png) no-repeat;
}
.reg-form .safe {
margin:0 0 5px 170px;
}
.safe i {
color: #000;
}
.safe em {
padding: 0 12px;
color: #fff;
}
.easy {
background-color: #de1111;
}
.normal {
background-color: #40b83f;
}
.hard {
background-color: #f79100;
}
.agree {
margin: 80px 0 0 110px;
}
.agree-left {
display: inline-block;
color: #000;
}
#cb {
vertical-align: middle;
}
.agree-left a {
font-size: 14px;
color: #1ba1e6;
}
.agree-right {
display: inline-block;
width: 200px;
height: 32px;
margin-left: 10px;
background-color: #c81623;
font-size: 16px;
border: 0;
color: #fff;
cursor: pointer;
}
6、JS
index.js
window.addEventListener('load', function() {
var focus = document.querySelector('.focus');
var arL = document.querySelector('.arrow-l');
var arR = document.querySelector('.arrow-r');
focus.addEventListener('mouseenter', function() {
arL.style.display = 'block';
arR.style.display = 'block';
clearInterval(timer);
timer = null;
});
focus.addEventListener('mouseleave', function() {
arL.style.display = 'none';
arR.style.display = 'none';
timer = setInterval(function() {
arR.click(); // 手动调用点击事件
}, 3000);
});
var ul = focus.querySelector('ul');
var ol = focus.querySelector('.circle');
var focusWidth = focus.offsetWidth;
for (var i = 0; i < ul.children.length; i++) {
// 1、根据图片数创建li
var li = document.createElement('li');
ol.appendChild(li); // 动态创建li插入到ol中
li.setAttribute('index', i); // 通过自定义属性记录小圆圈当前索引号
// 每生成一个li,就绑定一个点击事件
li.addEventListener('click', function() {
// 2、点击小圆圈的排他算法
for (var i = 0; i < ol.children.length; i++) {
ol.children[i].className = '';
}
this.className = 'current';
// 3、图片滚动的动画函数
var index = this.getAttribute('index');
num = cir = index; // 当点击某个li,把这个li的索引号给num、cir
// 通过小圆圈索引值计算图片移动距离
animate(ul, -index * focusWidth);
})
}
ol.children[0].className = 'current';
// 4、克隆图片
var first = ul.children[0].cloneNode(true);
ul.appendChild(first);
// 深克隆1张图片至ul,因为在li的生成之后,所以小圆圈个数不会因此增加
// 5、点击右键,图片无缝滚动
var num = 0;
var cir = 0;
arR.addEventListener('click', function() {
if (num == ul.children.length - 1) {
num = 0;
ul.style.left = 0;
}
num++;
animate(ul, -num * focusWidth);
cir++;
if (cir == ol.children.length) {
cir = 0;
}
cirChange();
});
// 6、点击左键,图片无缝滚动
arL.addEventListener('click', function() {
if (num == 0) {
num = ul.children.length - 1;
ul.style.left = -num * focusWidth + 'px';
}
num--;
animate(ul, -num * focusWidth);
cir--;
cir = cir < 0 ? ol.children.length - 1 : cir;
cirChange();
});
function cirChange() {
for (var i = 0; i < ol.children.length; i++) {
ol.children[i].className = '';
}
ol.children[cir].className = 'current';
}
// 7、自动轮播
var timer = setInterval(function() {
arR.click(); // 手动调用点击事件
}, 3000);
});
phone detail.js
window.addEventListener('load', function() {
var dt = document.querySelector('.dt');
var dd = document.querySelector('.dd');
var preImg = document.querySelector('.pre-img');
var mask = document.querySelector('.mask');
var big = document.querySelector('.big');
dt.addEventListener('mousemove', function() {
dd.style.display = 'block';
dd.style.zIndex = '999';
});
dt.addEventListener('mouseout', function() {
dd.style.display = 'none';
dd.style.zIndex = '-1';
});
dd.addEventListener('mousemove', function() {
dd.style.display = 'block';
dd.style.zIndex = '999';
});
dd.addEventListener('mouseout', function() {
dd.style.display = 'none';
dd.style.zIndex = '-1';
});
preImg.addEventListener('mousemove', function(e) {
mask.style.display = 'block';
big.style.display = 'block';
// 1、先计算出鼠标在盒子内的坐标,此时鼠标位置在mask的左上角
var x = e.pageX - this.offsetLeft;
var y = e.pageY - this.offsetTop;
// 若preImg有定位了的父级盒子,则this.offsetLeft得到的是preImg与其父级盒子的左侧距离
// 2、让mask往上走mask高度的一半,往左走mask宽度的一半,即可让鼠标在mask的中心位置
var maskX = x - mask.offsetWidth / 2;
var maskY = y - mask.offsetHeight / 2;
// 3、若maskX小于0,则让mask停在0的位置(maskY同理),即不让mask跑出preImg
var maskMax = preImg.offsetWidth - mask.offsetWidth; // mask最大移动距离
if (maskX <= 0) {
maskX = 0;
} else if (maskX >= maskMax) {
maskX = maskMax;
}
if (maskY <= 0) {
maskY = 0;
} else if (maskY >= maskMax) {
maskY = maskMax;
}
mask.style.left = maskX + 'px';
mask.style.top = maskY + 'px';
// 4、bigImg移动距离 = mask移动距离 * bigImg最大移动距离 / mask最大移动距离
var bigImg = document.querySelector('.bigImg')
var bigMax = bigImg.offsetWidth - big.offsetWidth;
// bigImg的移动距离
var bigX = maskX * bigMax / maskMax;
var bigY = maskY * bigMax / maskMax;
// bigImg与mask的移动距离相反
bigImg.style.left = -bigX + 'px';
bigImg.style.top = -bigY + 'px';
});
preImg.addEventListener('mouseout', function() {
mask.style.display = 'none';
big.style.display = 'none';
});
});
animate.js
function animate(obj, target, callback) {
clearInterval(obj.timer);
obj.timer = setInterval(function() {
var step = (target - obj.offsetLeft) / 10;
step = step > 0 ? Math.ceil(step) : Math.floor(step);
if (obj.offsetLeft == target) {
clearInterval(obj.timer);
callback && callback();
}
obj.style.left = obj.offsetLeft + step + 'px';
}, 15);
}
7、jQuery
jQuery.min.js
shopCar.js
$(function() {
// 1、当全选按钮变化时,小的选择按钮(包括另一个全选按钮)通过其变化进行属性赋值(相应变化)
$('.checkall').change(function() {
$('.j-checkbox, .checkall').prop('checked', $(this).prop('checked'));
// $(this).prop('checked'): true / false
if ($(this).prop('checked')) {
// 全选选中时,为每个商品添加背景颜色的类
$('.cart-item').addClass('check-cart-item');
} else {
$('.cart-item').removeClass('check-cart-item');
}
});
// 2、每当1个小的选择按钮被选中时,就检查被选中的小按钮个数是否等于小按钮数
$('.j-checkbox').change(function() {
if ($('.j-checkbox:checked').length == $('.j-checkbox').length) {
// $('.j-checkbox:checked').length:小按钮选中个数
$('.checkall').prop('checked', true); // 小按钮全选上则全选按钮选中
} else {
// 反之全选不选
$('.checkall').prop('checked', false);
}
if ($(this).prop('checked')) {
// 选择按钮选中时,为对应商品添加背景颜色的类
$(this).parents('.cart-item').addClass('check-cart-item');
} else {
$(this).parents('.cart-item').removeClass('check-cart-item');
}
});
// 3、点击+-键改变商品件数与同种商品的总计价格
$('.incre').click(function() {
// 先从文本框获取数字(为避免用户直接输入数字而导致错误)
var n = $(this).siblings('.itxt').val();
n++; // 按1次+键增加1件
$(this).siblings('.itxt').val(n); // 将变化后的数输入文本框
var p = $(this).parents().siblings('.p-price').html().substr(1);// 截得'¥'之后的数字
// 取父级再取兄弟而不直接取类的原因是:通过jQ的隐式迭代取得对应价格(而不是统一取,统一改变)
$(this).parents().siblings('.p-sum').html(('¥' + (p * n).toFixed(2)));
getSum();
});
$('.decre').click(function() {
var n = $(this).siblings('.itxt').val();
if (n == 0) {
return false;
} // 若件数为0,则return(之后代码不执行)
n--;
$(this).siblings('.itxt').val(n);
var p = $(this).parents().siblings('.p-price').html().substr(1);
$(this).parents().siblings('.p-sum').html(('¥' + (p * n).toFixed(2)));
getSum();
});
// 4、修改文本框中的商品数时,同种商品的总计价格随之改变
$('.itxt').change(function() {
var n = $(this).val();
var p =$(this).parents().siblings('.p-price').html().substr(1);
$(this).parents().siblings('.p-sum').html(('¥' + (p * n).toFixed(2)));
getSum();
})
// 5、点击+-键、修改商品件数,会计算总件数和总额
getSum(); // 刷新页面时,没有操作,也会先计算1次
function getSum() {
var count = 0;
var money = 0;
$('.itxt').each(function(i, ele) {
count += parseInt($(ele).val());
}); // 遍历itxt,取出其文本数值,进行总计
$('.amount-sum em').text(count); // 总件数
$('.p-sum').each(function(i, ele) {
money += parseFloat($(ele).text().substr(1));
});
$('.price-sum em').text('¥' + money.toFixed(2)); // 总额
}
// 6、删除商品
$('.p-action a').click(function() {
$(this).parents('.cart-items').remove();
getSum();
}); // 点击'删除',删除整行商品
$('.remove-batch').click(function() {
$('.j-checkbox:checked').parents('.cart-item').remove();
getSum();
}); // 点击'删除选中商品',删除对应行商品
$('.clear-all').click(function() {
$('.cart-item').remove();
getSum();
}); // 点击清空购物车,删除所有商品
})
8、页面