Showing
1 changed file
with
27 additions
and
21 deletions
@@ -98,33 +98,14 @@ function thumbTouchEvt(e) { | @@ -98,33 +98,14 @@ function thumbTouchEvt(e) { | ||
98 | myScroll && myScroll.refresh(); | 98 | myScroll && myScroll.refresh(); |
99 | } | 99 | } |
100 | 100 | ||
101 | -ellipsis.init(); | ||
102 | - | ||
103 | -lazyLoad($('.lazy')); | ||
104 | - | ||
105 | -//title mlellipsis | ||
106 | -$('.info-list .title, .one-good .reco-name').each(function() { | ||
107 | - this.mlellipsis(2); | ||
108 | -}); | ||
109 | - | ||
110 | -//offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名 | ||
111 | -if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) === | ||
112 | - parseInt($authorIntro.css('margin-left'), 10))) { | ||
113 | - $authorIntro.css('padding-top', 0); | ||
114 | -} | ||
115 | - | ||
116 | // 初始化iscroll | 101 | // 初始化iscroll |
117 | -window.onload = function() { | 102 | +function initIscroll() { |
118 | var $scroller = $('#scroller'), | 103 | var $scroller = $('#scroller'), |
119 | $yohoHeader = $('.yoho-header'); | 104 | $yohoHeader = $('.yoho-header'); |
120 | 105 | ||
121 | var hH = 0, | 106 | var hH = 0, |
122 | winH, tcH, cbH, cbTop, fixedThumbDom; | 107 | winH, tcH, cbH, cbTop, fixedThumbDom; |
123 | 108 | ||
124 | - if (!pageInIscroll) { | ||
125 | - return; | ||
126 | - } | ||
127 | - | ||
128 | //考虑通用头部的影响:对offset().top以及winH做对应偏移 | 109 | //考虑通用头部的影响:对offset().top以及winH做对应偏移 |
129 | if ($yohoHeader.length > 0) { | 110 | if ($yohoHeader.length > 0) { |
130 | hH = $yohoHeader.outerHeight(); | 111 | hH = $yohoHeader.outerHeight(); |
@@ -193,15 +174,35 @@ window.onload = function() { | @@ -193,15 +174,35 @@ window.onload = function() { | ||
193 | } | 174 | } |
194 | $scroller.trigger('scroll'); | 175 | $scroller.trigger('scroll'); |
195 | }); | 176 | }); |
177 | +} | ||
178 | + | ||
179 | +//window onload 后重新refresh iscroll | ||
180 | +window.onload = function() { | ||
181 | + myScroll && myScroll.refresh(); | ||
196 | }; | 182 | }; |
197 | 183 | ||
198 | -//是否使用iscroll初始化页面 | 184 | +//初始化页面,包括是否使用iscorll初始化页面 |
199 | //接口暴露在HTML中,使用压缩名 | 185 | //接口暴露在HTML中,使用压缩名 |
200 | exports.i = function(useIscroll) { | 186 | exports.i = function(useIscroll) { |
201 | var isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false; | 187 | var isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false; |
202 | 188 | ||
203 | pageInIscroll = isIphone && useIscroll; | 189 | pageInIscroll = isIphone && useIscroll; |
204 | 190 | ||
191 | + ellipsis.init(); | ||
192 | + | ||
193 | + lazyLoad($('.lazy')); | ||
194 | + | ||
195 | + //title mlellipsis | ||
196 | + $('.info-list .title, .one-good .reco-name').each(function() { | ||
197 | + this.mlellipsis(2); | ||
198 | + }); | ||
199 | + | ||
200 | + //offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名 | ||
201 | + if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) === | ||
202 | + parseInt($authorIntro.css('margin-left'), 10))) { | ||
203 | + $authorIntro.css('padding-top', 0); | ||
204 | + } | ||
205 | + | ||
205 | if (pageInIscroll) { | 206 | if (pageInIscroll) { |
206 | if ($('.yoho-header').length > 0) { | 207 | if ($('.yoho-header').length > 0) { |
207 | $('#wrapper').addClass('ios has-head'); | 208 | $('#wrapper').addClass('ios has-head'); |
@@ -237,6 +238,11 @@ exports.i = function(useIscroll) { | @@ -237,6 +238,11 @@ exports.i = function(useIscroll) { | ||
237 | 238 | ||
238 | if (pageInIscroll) { | 239 | if (pageInIscroll) { |
239 | $fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt); | 240 | $fixedThumbContainer.delegate('.thumb', 'touchend', thumbTouchEvt); |
241 | + | ||
240 | } | 242 | } |
241 | } | 243 | } |
244 | + | ||
245 | + if (pageInIscroll) { | ||
246 | + initIscroll(); | ||
247 | + } | ||
242 | }; | 248 | }; |
-
Please register or login to post a comment