-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (155 loc) · 4.18 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<link rel="stylesheet" href="css/style.css">
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script src="js/iscroll.js"></script>
<title>手机端上拉查看详情</title>
<style type="text/css">
.tab {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
box-sizing: border-box;
background-color: #ededed;
}
.tab .tab_box {
width: 100%;
/*height: 50px;*/
box-sizing: border-box;
}
.tab .tab_box li {
float: left;
width: 50%;
padding: 0 10px;
height: 45px;
line-height: 45px;
display: block;
text-align: center;
box-sizing: border-box;
}
.tab .tab_box li.active {
border-bottom: 1px solid red;
}
.more-up {
text-align: center;
}
.show-flip {display: none;}
.flip .show-flip{ display: block;}
.flip .hide-flip{ display: none;}
</style>
</head>
<body>
<!-- <header>这是头部</header> -->
<div class="tab">
<ul class="tab_box">
<li class="active">商品</li>
<li>详情</li>
</ul>
</div>
<div class="tab_list">
<div id="wrapper" class="tab_cont">
<div class="scroller">
<ul>
<li>商品信息商品信息商品信息商品信息</li>
<li>商品信息商品信息商品信息商品信息</li>
<li>商品信息商品信息商品信息商品信息</li>
<li>商品信息商品信息商品信息商品信息</li>
<li>商品信息商品信息商品信息商品信息</li>
</ul>
<div class="more"><i class="pull_icon"></i><span>上拉查看详情...</span></div>
</div>
</div>
<div id="wrapper-detail" class="tab_cont" style="display: none;margin-top: 40px;font-size: 18px;padding: 10px;">
<div class="scroller">
<div class="more-up">
<span class="show-flip">释放回到商品详情</span>
<span class="hide-flip">下拉回到商品详情</span>
</div>
详情详情详情详情详情详情详情详情详情详情详情详情详情
<br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
</div>
</div>
<footer>这是底部</footer>
<script>
var myscroll = new iScroll("wrapper",{
onScrollMove:function(){
// console.log(this.y);
// console.log(this.maxScrollY);
if ((this.y + 70)<(this.maxScrollY)) {
$('.pull_icon').addClass('flip');
}else{
$('.pull_icon').removeClass('flip loading');
}
},
onScrollEnd:function(){
if ($('.pull_icon').hasClass('flip')) {
pullUpAction();
}
},
onRefresh:function(){
$('.more').removeClass('flip');
}
});
var myscroll2 = new iScroll("wrapper-detail",{
onScrollMove:function(){
console.log('this.y' + this.y);
console.log('this.maxScrollY' +this.maxScrollY);
if ((this.y)>(70)) {
$('.more-up').addClass('flip');
}else{
$('.more-up').removeClass('flip loading');
}
},
onScrollEnd:function(){
if ($('.more-up').hasClass('flip')) {
pullUpAction2();
}
},
onRefresh:function(){
$('.more-up').removeClass('flip');
}
});
function pullUpAction2() {
console.log("go up");
$('.more-up').removeClass('flip');
setTimeout(function(){
// console.log(11111111);
$('.tab_box li').eq(0).addClass('active');
$('.tab_box li').eq(1).removeClass('active');
$('.tab_cont').hide();
$('.tab_cont').eq(0).show();
// myscroll.refresh();
}, 200)
}
function pullUpAction(){
setTimeout(function(){
// console.log(11111111);
$('.tab_box li').eq(0).removeClass('active');
$('.tab_box li').eq(1).addClass('active');
$('.tab_cont').hide();
$('.tab_cont').eq(1).show();
// myscroll.refresh();
}, 200)
}
if ($('.scroller').height()<$('#wrapper').height()) {
$('.more').hide();
myscroll.destroy();
}
$('.tab_box li').on('click',function() {
$(this).siblings('li').removeClass('active');
$(this).addClass('active');
var index = $(this).index();
// console.log(index);
$('.tab_cont').hide();
$('.tab_cont').eq(index).show();
})
</script>
</body>
</html>