|
@@ -7,8 +7,8 @@ require("guang/info-index.page.css") |
|
@@ -7,8 +7,8 @@ require("guang/info-index.page.css") |
7
|
|
7
|
|
8
|
var $ = require('yoho-jquery'),
|
8
|
var $ = require('yoho-jquery'),
|
9
|
ellipsis = require('yoho-mlellipsis'),
|
9
|
ellipsis = require('yoho-mlellipsis'),
|
10
|
- lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
11
|
- IScroll = require('yoho-iscroll/build/iscroll-probe');
|
10
|
+ lazyLoad = require('yoho-jquery-lazyload');
|
|
|
11
|
+//IScroll = require('yoho-iscroll/build/iscroll-probe');
|
12
|
|
12
|
|
13
|
var $authorIntro = $('.author .intro');
|
13
|
var $authorIntro = $('.author .intro');
|
14
|
|
14
|
|
|
@@ -31,6 +31,10 @@ require('../common'); |
|
@@ -31,6 +31,10 @@ require('../common'); |
31
|
require('../plugin/wx-share')();
|
31
|
require('../plugin/wx-share')();
|
32
|
require('./detail-dynamic');
|
32
|
require('./detail-dynamic');
|
33
|
|
33
|
|
|
|
34
|
+$('#wrapper').css({
|
|
|
35
|
+ 'overflow-y': 'scroll'
|
|
|
36
|
+});
|
|
|
37
|
+
|
34
|
/**
|
38
|
/**
|
35
|
* 计算搭配的箭头的位置
|
39
|
* 计算搭配的箭头的位置
|
36
|
* @param $curPos 当前focus的搭配项
|
40
|
* @param $curPos 当前focus的搭配项
|
|
@@ -112,16 +116,15 @@ function initIscroll() { |
|
@@ -112,16 +116,15 @@ function initIscroll() { |
112
|
if ($yohoHeader.length > 0) {
|
116
|
if ($yohoHeader.length > 0) {
|
113
|
hH = $yohoHeader.outerHeight();
|
117
|
hH = $yohoHeader.outerHeight();
|
114
|
}
|
118
|
}
|
115
|
-
|
|
|
116
|
- myScroll = new IScroll('#wrapper', {
|
|
|
117
|
- probeType: 3,
|
|
|
118
|
- mouseWheel: true,
|
|
|
119
|
- click: true
|
|
|
120
|
- });
|
|
|
121
|
-
|
|
|
122
|
- document.addEventListener('touchmove', function(e) {
|
|
|
123
|
- e.preventDefault();
|
|
|
124
|
- }, false);
|
119
|
+ /*
|
|
|
120
|
+ myScroll = new IScroll('#wrapper', {
|
|
|
121
|
+ probeType: 3,
|
|
|
122
|
+ mouseWheel: true,
|
|
|
123
|
+ click: true
|
|
|
124
|
+ });
|
|
|
125
|
+ document.addEventListener('touchmove', function(e) {
|
|
|
126
|
+ e.preventDefault();
|
|
|
127
|
+ }, false);
|
125
|
|
128
|
|
126
|
if (!hasCollocationBlock) {
|
129
|
if (!hasCollocationBlock) {
|
127
|
myScroll.on('scroll', function() {
|
130
|
myScroll.on('scroll', function() {
|
|
@@ -130,6 +133,9 @@ function initIscroll() { |
|
@@ -130,6 +133,9 @@ function initIscroll() { |
130
|
return;
|
133
|
return;
|
131
|
}
|
134
|
}
|
132
|
|
135
|
|
|
|
136
|
+ */
|
|
|
137
|
+
|
|
|
138
|
+
|
133
|
winH = $(window).height() - hH;
|
139
|
winH = $(window).height() - hH;
|
134
|
fixedThumbDom = $fixedThumbContainer[0];
|
140
|
fixedThumbDom = $fixedThumbContainer[0];
|
135
|
|
141
|
|
|
@@ -137,56 +143,59 @@ function initIscroll() { |
|
@@ -137,56 +143,59 @@ function initIscroll() { |
137
|
cbH = $coBlock.outerHeight();
|
143
|
cbH = $coBlock.outerHeight();
|
138
|
cbTop = $coBlock.offset().top - hH;
|
144
|
cbTop = $coBlock.offset().top - hH;
|
139
|
|
145
|
|
140
|
- myScroll.on('scroll', function() {
|
146
|
+ $(window).on('scroll', function() {
|
|
|
147
|
+ console.log(1);
|
141
|
var sTop = -this.y;
|
148
|
var sTop = -this.y;
|
142
|
var classList = fixedThumbDom.className;
|
149
|
var classList = fixedThumbDom.className;
|
143
|
|
150
|
|
144
|
if (sTop <= cbTop - winH + tcH) {
|
151
|
if (sTop <= cbTop - winH + tcH) {
|
145
|
if (classList.indexOf('fixed-bottom') === -1) {
|
152
|
if (classList.indexOf('fixed-bottom') === -1) {
|
146
|
$fixedThumbContainer
|
153
|
$fixedThumbContainer
|
147
|
- .addClass('fixed-bottom')
|
|
|
148
|
- .removeClass('hide');
|
154
|
+ .addClass('fixed-bottom')
|
|
|
155
|
+ .removeClass('hide');
|
149
|
}
|
156
|
}
|
150
|
} else if (sTop <= cbTop) {
|
157
|
} else if (sTop <= cbTop) {
|
151
|
if (classList.indexOf('hide') === -1) {
|
158
|
if (classList.indexOf('hide') === -1) {
|
152
|
$fixedThumbContainer
|
159
|
$fixedThumbContainer
|
153
|
- .addClass('hide')
|
|
|
154
|
- .removeClass('fixed-bottom fixed-top');
|
160
|
+ .addClass('hide')
|
|
|
161
|
+ .removeClass('fixed-bottom fixed-top');
|
155
|
}
|
162
|
}
|
156
|
} else if (sTop <= cbTop + cbH - tcH) {
|
163
|
} else if (sTop <= cbTop + cbH - tcH) {
|
157
|
if (classList.indexOf('fixed-top') === -1) {
|
164
|
if (classList.indexOf('fixed-top') === -1) {
|
158
|
$fixedThumbContainer
|
165
|
$fixedThumbContainer
|
159
|
- .addClass('fixed-top')
|
|
|
160
|
- .removeClass('hide absolute')
|
|
|
161
|
- .css('top', '');
|
166
|
+ .addClass('fixed-top')
|
|
|
167
|
+ .removeClass('hide absolute')
|
|
|
168
|
+ .css('top', '');
|
162
|
}
|
169
|
}
|
163
|
} else if (sTop <= cbTop + cbH) {
|
170
|
} else if (sTop <= cbTop + cbH) {
|
164
|
if (classList.indexOf('absolute') === -1) {
|
171
|
if (classList.indexOf('absolute') === -1) {
|
165
|
$fixedThumbContainer
|
172
|
$fixedThumbContainer
|
166
|
- .addClass('absolute')
|
|
|
167
|
- .removeClass('fixed-top hide');
|
173
|
+ .addClass('absolute')
|
|
|
174
|
+ .removeClass('fixed-top hide');
|
168
|
}
|
175
|
}
|
169
|
fixedThumbDom.style.top = cbTop + hH + cbH - tcH - sTop + 'px';
|
176
|
fixedThumbDom.style.top = cbTop + hH + cbH - tcH - sTop + 'px';
|
170
|
} else if (sTop > cbTop + cbH) {
|
177
|
} else if (sTop > cbTop + cbH) {
|
171
|
if (classList.indexOf('hide') === -1) {
|
178
|
if (classList.indexOf('hide') === -1) {
|
172
|
$fixedThumbContainer
|
179
|
$fixedThumbContainer
|
173
|
- .addClass('hide')
|
|
|
174
|
- .removeClass('absolute');
|
180
|
+ .addClass('hide')
|
|
|
181
|
+ .removeClass('absolute');
|
175
|
}
|
182
|
}
|
176
|
}
|
183
|
}
|
177
|
- $scroller.trigger('scroll');
|
184
|
+ //$scroller.trigger('scroll');
|
178
|
});
|
185
|
});
|
179
|
}
|
186
|
}
|
180
|
|
187
|
|
181
|
-// window onload 后重新refresh iscroll
|
|
|
182
|
-window.onload = function() {
|
|
|
183
|
- myScroll && myScroll.refresh();
|
|
|
184
|
-};
|
188
|
+/*
|
|
|
189
|
+ // window onload 后重新refresh iscroll
|
|
|
190
|
+ window.onload = function() {
|
|
|
191
|
+ myScroll && myScroll.refresh();
|
|
|
192
|
+ };
|
185
|
|
193
|
|
186
|
-// 图片加载完成之后重新 refresh iscroll
|
|
|
187
|
-$('img').on('load', function() {
|
|
|
188
|
- myScroll && myScroll.refresh();
|
|
|
189
|
-});
|
194
|
+ // 图片加载完成之后重新 refresh iscroll
|
|
|
195
|
+ $('img').on('load', function() {
|
|
|
196
|
+ myScroll && myScroll.refresh();
|
|
|
197
|
+ });
|
|
|
198
|
+ */
|
190
|
|
199
|
|
191
|
// 初始化页面,包括是否使用iscorll初始化页面
|
200
|
// 初始化页面,包括是否使用iscorll初始化页面
|
192
|
// 接口暴露在HTML中,使用压缩名
|
201
|
// 接口暴露在HTML中,使用压缩名
|
|
@@ -231,17 +240,19 @@ $('img').on('load', function() { |
|
@@ -231,17 +240,19 @@ $('img').on('load', function() { |
231
|
|
240
|
|
232
|
// offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名
|
241
|
// offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名
|
233
|
if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) ===
|
242
|
if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) ===
|
234
|
- parseInt($authorIntro.css('margin-left'), 10))) {
|
243
|
+ parseInt($authorIntro.css('margin-left'), 10))) {
|
235
|
$authorIntro.css('padding-top', 0);
|
244
|
$authorIntro.css('padding-top', 0);
|
236
|
}
|
245
|
}
|
|
|
246
|
+ /*
|
237
|
|
247
|
|
238
|
- if (pageInIscroll) {
|
|
|
239
|
- if ($('.yoho-header').length > 0) {
|
|
|
240
|
- $('#wrapper').addClass('ios has-head');
|
|
|
241
|
- } else {
|
|
|
242
|
- $('#wrapper').addClass('ios');
|
|
|
243
|
- }
|
|
|
244
|
- }
|
248
|
+ if (pageInIscroll) {
|
|
|
249
|
+ if ($('.yoho-header').length > 0) {
|
|
|
250
|
+ $('#wrapper').addClass('ios has-head');
|
|
|
251
|
+ } else {
|
|
|
252
|
+ $('#wrapper').addClass('ios');
|
|
|
253
|
+ }
|
|
|
254
|
+ }
|
|
|
255
|
+ */
|
245
|
|
256
|
|
246
|
// 有搭配模块,iphone使用iscroll初始化滚动并有固定的搭配栏,其他的没有
|
257
|
// 有搭配模块,iphone使用iscroll初始化滚动并有固定的搭配栏,其他的没有
|
247
|
if (hasCollocationBlock) {
|
258
|
if (hasCollocationBlock) {
|
|
@@ -270,7 +281,6 @@ $('img').on('load', function() { |
|
@@ -270,7 +281,6 @@ $('img').on('load', function() { |
270
|
|
281
|
|
271
|
if (pageInIscroll) {
|
282
|
if (pageInIscroll) {
|
272
|
$fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt);
|
283
|
$fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt);
|
273
|
-
|
|
|
274
|
}
|
284
|
}
|
275
|
}
|
285
|
}
|
276
|
|
286
|
|
|
@@ -278,3 +288,4 @@ $('img').on('load', function() { |
|
@@ -278,3 +288,4 @@ $('img').on('load', function() { |
278
|
initIscroll();
|
288
|
initIscroll();
|
279
|
}
|
289
|
}
|
280
|
}());
|
290
|
}());
|
|
|
291
|
+ |