1、针对浏览器整个窗口滚动 主要代码:
1 <script type="text/javascript">
2 var pageNum = 1;
3 function GetProductListPageFun() { //请求获取数据
4
5 }
6 $(window).scroll(function () { //分页
7 if ($(window).scrollTop() + $(window).height() == $(document).height()) { //滚动到底部时
8 pageNum += 1;
9 GetProductListPageFun();
10 }
11 });
12 </script>
2、一个页面div 内 的滚动条下拉 到底部,触发事件(加载更多内容) 完整代码(注意:div 必须出现滚动条 , 此方法才有效):
1 <!DOCTYPE=html>
2 <html>
3 <head>
4 <script src="../Js/jquery-1.9.1.min.js" type="text/javascript"></script>
5 </head>
6 <body>
7 <div>
8 测试 div 滚动条下拉掉浏览器底部加载</div>
9 <div class="scrollDiv" style="height: 500px; overflow: auto;">
10 <div class="childDiv" style='border: 1px solid Black; margin-top: 20px; color: Green; height: 600px'>
11 </div>
12 </div>
13 </body>
14 <script type="text/javascript">
15 //关键代码 注意:div 必须出现滚动条 , 此方法才有效
16 $(document).ready(function () {
17 $(".scrollDiv").unbind("scroll").on("scroll", function (e) { //注意:含有css类名为:scrollDiv 的div 要出现 滚动条 此函数(scroll)才会触发
18 var sum = this.scrollHeight; //滚动条距顶部距离(页面超出窗口的高度)
19 var $obj = $(this);
20 if (sum <= $obj.scrollTop() + $obj.height()) { //判断滚动条是否 到达了 底部 , $obj.scrollTop():滚动条距顶部距离(页面超出窗口的高度) ,$obj.height():当前(div)滚动窗口的高度
21 //div 的滚动条 滚动到浏览器底部 时 需要处理的逻辑
22 //$(".scrollDiv").append($(".childDiv").clone());
23 console.log("滚动条到达浏览器底部");
24 alert("滚动条到达浏览器底部");
25 }
26 });
27 });
28 </script>
29 </html>
View Code
3、一个页面 有多个div(tab)可以 切换 ,而且 div 内 的滚动条下拉 到底部,触发事件(加载更多内容) 完整代码(注意:div 必须出现滚动条 , 此方法才有效):
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>测试 div 滚动下拉加载</title>
5 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7 <meta name="apple-mobile-web-app-capable" content="yes">
8 <meta name="apple-mobile-web-app-status-bar-style" content="black">
9 <meta content="telephone=no" name="format-detection">
10 <meta content="on" http-equiv="x-dns-prefetch-control">
11 <script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
12 <script type="text/javascript">
13 //关键代码 注意:div 必须出现滚动条 , 此方法才有效
14 $(document).ready(function () {
15 $(".content-slide").height(parseFloat($(window).height()) - parseFloat($(".commenthead").height()) - 20); //设置高度让div 出现滚动条
16 $(".content-slide").unbind("scroll").on("scroll", function (e) { //注意:含有css类名为: content-slide 的div 要出现 滚动条 此函数(scroll)才会触发
17 var sum = this.scrollHeight; //滚动条距顶部距离(页面超出窗口的高度)
18 var $obj = $(this);
19 if (sum <= $obj.scrollTop() + $obj.height()) { //判断滚动条是否 到达了 底部 , $obj.scrollTop():滚动条距顶部距离(页面超出窗口的高度) ,$obj.height():当前(div)滚动窗口的高度
20 //div 的滚动条 滚动到浏览器底部 时 需要处理的逻辑
21 console.log("div_" + $(this).attr("status") + "滚动条到达浏览器底部");
22 alert("div_" + $obj.attr("status") + "滚动条到达浏览器底部");
23 }
24 });
25 });
26 </script>
27 </head>
28 <body>
29 <header class="commenthead whiteback">
30 网页头部:(下拉 加载 更多)
31 </header>
32 <article class="commentWrap nonebottom">
33 <div class="tabs">
34 <a href="JavaScript:;" class="active">div_1</a>
35 <a href="JavaScript:;" >div_2</a>
36 <a href="JavaScript:;" >div_3</a>
37 <a href="JavaScript:;" >div_4</a>
38 </div>
39 <div class="swiper-container">
40 <div class="swiper-wrapper" >
41 <div class="swiper-slide swiper-slide-visible swiper-slide-active">
42 <div class="content-slide tab1" status="1" style="height:200px;overflow:auto;" >
43 <div class="order_li">
44 <img src="../Images/0.jpg" />
45 </div>
46 <div class="order_li">
47 <img src="../Images/1.jpg" />
48 </div>
49 <div class="order_li">
50 <img src="../Images/2.jpg" />
51 </div>
52 </div>
53 </div>
54 <div class="swiper-slide" >
55 <div class="content-slide" status="2" style="height:200px;overflow:auto;" >
56 <div class="order_li">
57 <img src="../Images/3.jpg" />
58 </div>
59 <div class="order_li">
60 <img src="../Images/4.jpg" />
61 </div>
62 <div class="order_li">
63 <img src="../Images/5.jpg" />
64 </div>
65 </div>
66 </div>
67 <div class="swiper-slide" >
68 <div class="content-slide" status="3" style="height:200px;overflow:auto;" >
69 <div class="order_li">
70 <img src="../Images/0.jpg" />
71 </div>
72 <div class="order_li">
73 <img src="../Images/1.jpg" />
74 </div>
75 <div class="order_li">
76 <img src="../Images/2.jpg" />
77 </div>
78 </div>
79 </div>
80 <div class="swiper-slide" >
81 <div class="content-slide" status="4" style="height:200px;overflow:auto;" >
82 <div class="order_li">
83 <img src="../Images/3.jpg" />
84 </div>
85 <div class="order_li">
86 <img src="../Images/5.jpg" />
87 </div>
88 <div class="order_li">
89 <img src="../Images/4.jpg" />
90 </div>
91 </div>
92 </div>
93 </div>
94 </div>
95 </article>
96 <style type="text/css">
97 a
98 {
99 color: #333;
100 text-decoration: none;
101 }
102 .tabs
103 {
104 height: 35px;
105 background: #fff;
106 border-bottom: #F0F2F5 thin solid;
107 box-sizing: border-box;
108 display: block;
109 width: 100%;
110 }
111 .tabs a
112 {
113 display: inline-block;
114 float: left;
115 width: 20%;
116 margin: 0 2.5%;
117 text-align: center;
118 line-height: 35px;
119 font-size: 14px; /*padding: 0 10px;*/
120 box-sizing: border-box;
121 }
122 .tabs a.active
123 {
124 border-bottom: #E23030 2px solid;
125 color: #FF5500;
126 box-sizing: border-box;
127 }
128 .swiper-container
129 {
130 min-height: 400px;
131 width: 100%;
132 padding-bottom: 20px;
133 }
134 .swiper-slide
135 {
136 /*height: 325px;*/
137 width: 100%; /*background: none;*/ /*color: #fff;*/
138 }
139 .swiper-container
140 {
141 margin: 0 auto;
142 position: relative;
143 overflow: hidden;
144 -webkit-backface-visibility: hidden;
145 -moz-backface-visibility: hidden;
146 -ms-backface-visibility: hidden;
147 -o-backface-visibility: hidden;
148 backface-visibility: hidden; /* Fix of Webkit flickering */
149 z-index: 1;
150 }
151 .swiper-wrapper
152 {
153 position: relative;
154 width: 100%;
155 -webkit-transition-property: -webkit-transform, left, top;
156 -webkit-transition-duration: 0s;
157 -webkit-transform: translate3d(0px, 0, 0);
158 -webkit-transition-timing-function: ease;
159 -moz-transition-property: -moz-transform, left, top;
160 -moz-transition-duration: 0s;
161 -moz-transform: translate3d(0px, 0, 0);
162 -moz-transition-timing-function: ease;
163 -o-transition-property: -o-transform, left, top;
164 -o-transition-duration: 0s;
165 -o-transform: translate3d(0px, 0, 0);
166 -o-transition-timing-function: ease;
167 -o-transform: translate(0px, 0px);
168 -ms-transition-property: -ms-transform, left, top;
169 -ms-transition-duration: 0s;
170 -ms-transform: translate3d(0px, 0, 0);
171 -ms-transition-timing-function: ease;
172 transition-property: transform, left, top;
173 transition-duration: 0s;
174 transform: translate3d(0px, 0, 0);
175 transition-timing-function: ease;
176 -webkit-box-sizing: content-box;
177 -moz-box-sizing: content-box;
178 box-sizing: content-box;
179 }
180 .swiper-free-mode > .swiper-wrapper
181 {
182 -webkit-transition-timing-function: ease-out;
183 -moz-transition-timing-function: ease-out;
184 -ms-transition-timing-function: ease-out;
185 -o-transition-timing-function: ease-out;
186 transition-timing-function: ease-out;
187 margin: 0 auto;
188 }
189 .swiper-slide
190 {
191 float: left;
192 -webkit-box-sizing: content-box;
193 -moz-box-sizing: content-box; /*box-sizing: content-box;*/
194 }
195 .order_li
196 {
197 margin-bottom: 7px;
198 }
199 .order_li .cart_main_li
200 {
201 background: none !important;
202 margin-top: 0px;
203 padding-top: 3px;
204 padding-bottom: 3px;
205 }
206 .order_li .cart_main_right
207 {
208 width: 60%;
209 }
210 .order_li .cart_main_left
211 {
212 text-align: center;
213 width: 15%;
214 text-align: right;
215 padding-left: 5px;
216 box-sizing: border-box;
217 }
218 .order_li > p
219 {
220 line-height: 32px;
221 background: #fff;
222 height: 32px;
223 text-align: right;
224 padding: 0 10px;
225 }
226 .order_li > p:first-of-type
227 {
228 color: #FF5500;
229 }
230 .order_day
231 {
232 width: 60px;
233 text-align: center;
234 background: #E23030;
235 color: #fff;
236 line-height: 20px;
237 }
238 .order_li p button
239 {
240 border: #ccc thin solid;
241 background: #fff;
242 height: 28px;
243 padding: 0 10px;
244 }
245 .order_li .cart_main_left .old_price
246 {
247 text-decoration: line-through;
248 color: #CCCCCC;
249 }
250 .order_null
251 {
252 text-align: center;
253 margin: 70px 0;
254 }
255 .order_null img
256 {
257 width: 100px;
258 }
259 .order_null p:first-of-type
260 {
261 margin-top: 20px;
262 font-size: 16px;
263 color: #000;
264 }
265 /***************订单详情********************/.orderdetail
266 {
267 padding: 10px;
268 background: #fff;
269 line-height: 22px;
270 margin-bottom: 8px;
271 }
272 .orderdetail_add
273 {
274 padding-left: 20px;
275 background: url(../img/52.png) no-repeat left;
276 background-size: 15px;
277 }
278 .orderdetail_mess
279 {
280 padding: 10px;
281 background: #fff;
282 line-height: 18px;
283 }
284 .otherfoot .order_foot
285 {
286 text-align: left;
287 float: left;
288 width: 100px;
289 padding: 5px;
290 }
291 .order_foot_bt button
292 {
293 border: #ccc thin solid;
294 background: #fff;
295 height: 35px;
296 margin: 7px 10px 5px 0;
297 padding: 0 12px;
298 }
299 </style>
300 <script type="text/javascript">
301 /*
302 * Swiper 2.7.0
303 * Mobile touch slider and framework with hardware accelerated transitions
304 *
305 * http://www.idangero.us/sliders/swiper/
306 *
307 * Copyright 2010-2014, Vladimir Kharlampidi
308 * The iDangero.us
309 * http://www.idangero.us/
310 *
311 * Licensed under GPL & MIT
312 *
313 * Released on: August 30, 2014
314 */
315 var Swiper = function (a, b) {
316 "use strict";
317
318 function c(a, b) {
319 return document.querySelectorAll ? (b || document).querySelectorAll(a) : jQuery(a, b)
320 }
321
322 function d(a) {
323 return "[object Array]" === Object.prototype.toString.apply(a) ? !0 : !1
324 }
325
326 function e() {
327 var a = F - I;
328 return b.freeMode && (a = F - I), b.slidesPerView > C.slides.length && !b.centeredSlides && (a = 0), 0 > a && (a = 0), a
329 }
330
331 function f() {
332 function a(a) {
333 var c = new Image;
334 c.onload = function () {
335 "undefined" != typeof C && null !== C && (void 0 !== C.imagesLoaded && C.imagesLoaded++, C.imagesLoaded === C.imagesToLoad.length && (C.reInit(), b.onImagesReady && C.fireCallback(b.onImagesReady, C)))
336 }, c.src = a
337 }
338 var d = C.h.addEventListener,
339 e = "wrapper" === b.eventTarget ? C.wrapper : C.container;
340 if (C.browser.ie10 || C.browser.ie11 ? (d(e, C.touchEvents.touchStart, p), d(document, C.touchEvents.touchMove, q), d(document, C.touchEvents.touchEnd, r)) : (C.support.touch && (d(e, "touchstart", p), d(e, "touchmove", q), d(e, "touchend", r)), b.simulateTouch && (d(e, "mousedown", p), d(document, "mousemove", q), d(document, "mouseup", r))), b.autoResize && d(window, "resize", C.resizeFix), g(), C._wheelEvent = !1, b.mousewheelControl) {
341 if (void 0 !== document.onmousewheel && (C._wheelEvent = "mousewheel"), !C._wheelEvent) try {
342 new WheelEvent("wheel"), C._wheelEvent = "wheel"
343 } catch (f) { }
344 C._wheelEvent || (C._wheelEvent = "DOMMouseScroll"), C._wheelEvent && d(C.container, C._wheelEvent, j)
345 }
346 if (b.keyboardControl && d(document, "keydown", i), b.updateOnImagesReady) {
347 C.imagesToLoad = c("img", C.container);
348 for (var h = 0; h < C.imagesToLoad.length; h++) a(C.imagesToLoad[h].getAttribute("src"))
349 }
350 }
351
352 function g() {
353 var a, d = C.h.addEventListener;
354 if (b.preventLinks) {
355 var e = c("a", C.container);
356 for (a = 0; a < e.length; a++) d(e[a], "click", n)
357 }
358 if (b.releaseFormElements) {
359 var f = c("input, textarea, select", C.container);
360 for (a = 0; a < f.length; a++) d(f[a], C.touchEvents.touchStart, o, !0)
361 }
362 if (b.onSlideClick)
363 for (a = 0; a < C.slides.length; a++) d(C.slides[a], "click", k);
364 if (b.onSlideTouch)
365 for (a = 0; a < C.slides.length; a++) d(C.slides[a], C.touchEvents.touchStart, l)
366 }
367
368 function h() {
369 var a, d = C.h.removeEventListener;
370 if (b.onSlideClick)
371 for (a = 0; a < C.slides.length; a++) d(C.slides[a], "click", k);
372 if (b.onSlideTouch)
373 for (a = 0; a < C.slides.length; a++) d(C.slides[a], C.touchEvents.touchStart, l);
374 if (b.releaseFormElements) {
375 var e = c("input, textarea, select", C.container);
376 for (a = 0; a < e.length; a++) d(e[a], C.touchEvents.touchStart, o, !0)
377 }
378 if (b.preventLinks) {
379 var f = c("a", C.container);
380 for (a = 0; a < f.length; a++) d(f[a], "click", n)
381 }
382 }
383
384 function i(a) {
385 var b = a.keyCode || a.charCode;
386 if (!(a.shiftKey || a.altKey || a.ctrlKey || a.metaKey)) {
387 if (37 === b || 39 === b || 38 === b || 40 === b) {
388 for (var c = !1, d = C.h.getOffset(C.container), e = C.h.windowScroll().left, f = C.h.windowScroll().top, g = C.h.windowWidth(), h = C.h.windowHeight(), i = [
389 [d.left, d.top],
390 [d.left + C.width, d.top],
391 [d.left, d.top + C.height],
392 [d.left + C.width, d.top + C.height]
393 ], j = 0; j < i.length; j++) {
394 var k = i[j];
395 k[0] >= e && k[0] <= e + g && k[1] >= f && k[1] <= f + h && (c = !0)
396 }
397 if (!c) return
398 }
399 M ? ((37 === b || 39 === b) && (a.preventDefault ? a.preventDefault() : a.returnValue = !1), 39 === b && C.swipeNext(), 37 === b && C.swipePrev()) : ((38 === b || 40 === b) && (a.preventDefault ? a.preventDefault() : a.returnValue = !1), 40 === b && C.swipeNext(), 38 === b && C.swipePrev())
400 }
401 }
402
403 function j(a) {
404 var c = C._wheelEvent,
405 d = 0;
406 if (a.detail) d = -a.detail;
407 else if ("mousewheel" === c)
408 if (b.mousewheelControlForceToAxis)
409 if (M) {
410 if (!(Math.abs(a.wheelDeltaX) > Math.abs(a.wheelDeltaY))) return;
411 d = a.wheelDeltaX
412 } else {
413 if (!(Math.abs(a.wheelDeltaY) > Math.abs(a.wheelDeltaX))) return;
414 d = a.wheelDeltaY
415 } else d = a.wheelDelta;
416 else if ("DOMMouseScroll" === c) d = -a.detail;
417 else if ("wheel" === c)
418 if (b.mousewheelControlForceToAxis)
419 if (M) {
420 if (!(Math.abs(a.deltaX) > Math.abs(a.deltaY))) return;
421 d = -a.deltaX
422 } else {
423 if (!(Math.abs(a.deltaY) > Math.abs(a.deltaX))) return;
424 d = -a.deltaY
425 } else d = Math.abs(a.deltaX) > Math.abs(a.deltaY) ? -a.deltaX : -a.deltaY;
426 if (b.freeMode) {
427 var f = C.getWrapperTranslate() + d;
428 if (f > 0 && (f = 0), f < -e() && (f = -e()), C.setWrapperTransition(0), C.setWrapperTranslate(f), C.updateActiveSlide(f), 0 === f || f === -e()) return
429 } else (new Date).getTime() - U > 60 && (0 > d ? C.swipeNext() : C.swipePrev()), U = (new Date).getTime();
430 return b.autoplay && C.stopAutoplay(!0), a.preventDefault ? a.preventDefault() : a.returnValue = !1, !1
431 }
432
433 function k(a) {
434 C.allowSlideClick && (m(a), C.fireCallback(b.onSlideClick, C, a))
435 }
436
437 function l(a) {
438 m(a), C.fireCallback(b.onSlideTouch, C, a)
439 }
440
441 function m(a) {
442 if (a.currentTarget) C.clickedSlide = a.currentTarget;
443 else {
444 var c = a.srcElement;
445 do {
446 if (c.className.indexOf(b.slideClass) > -1) break;
447 c = c.parentNode
448 } while (c);
449 C.clickedSlide = c
450 }
451 C.clickedSlideIndex = C.slides.indexOf(C.clickedSlide), C.clickedSlideLoopIndex = C.clickedSlideIndex - (C.loopedSlides || 0)
452 }
453
454 function n(a) {
455 return C.allowLinks ? void 0 : (a.preventDefault ? a.preventDefault() : a.returnValue = !1, b.preventLinksPropagation && "stopPropagation" in a && a.stopPropagation(), !1)
456 }
457
458 function o(a) {
459 return a.stopPropagation ? a.stopPropagation() : a.returnValue = !1, !1
460 }
461
462 function p(a) {
463 if (b.preventLinks && (C.allowLinks = !0), C.isTouched || b.onlyExternal) return !1;
464 var c = a.target || a.srcElement;
465 document.activeElement && document.activeElement !== c && document.activeElement.blur();
466 var d = "input select textarea".split(" ");
467 if (b.noSwiping && c && s(c)) return !1;
468 if ($ = !1, C.isTouched = !0, Z = "touchstart" === a.type, !Z && "which" in a && 3 === a.which) return !1;
469 if (!Z || 1 === a.targetTouches.length) {
470 C.callPlugins("onTouchStartBegin"), !Z && !C.isAndroid && d.indexOf(c.tagName.toLowerCase()) < 0 && (a.preventDefault ? a.preventDefault() : a.returnValue = !1);
471 var e = Z ? a.targetTouches[0].pageX : a.pageX || a.clientX,
472 f = Z ? a.targetTouches[0].pageY : a.pageY || a.clientY;
473 C.touches.startX = C.touches.currentX = e, C.touches.startY = C.touches.currentY = f, C.touches.start = C.touches.current = M ? e : f, C.setWrapperTransition(0), C.positions.start = C.positions.current = C.getWrapperTranslate(), C.setWrapperTranslate(C.positions.start), C.times.start = (new Date).getTime(), H = void 0, b.moveStartThreshold > 0 && (W = !1), b.onTouchStart && C.fireCallback(b.onTouchStart, C, a), C.callPlugins("onTouchStartEnd")
474 }
475 }
476
477 function q(a) {
478 if (C.isTouched && !b.onlyExternal && (!Z || "mousemove" !== a.type)) {
479 var c = Z ? a.targetTouches[0].pageX : a.pageX || a.clientX,
480 d = Z ? a.targetTouches[0].pageY : a.pageY || a.clientY;
481 if ("undefined" == typeof H && M && (H = !!(H || Math.abs(d - C.touches.startY) > Math.abs(c - C.touches.startX))), "undefined" != typeof H || M || (H = !!(H || Math.abs(d - C.touches.startY) < Math.abs(c - C.touches.startX))), H) return void (C.isTouched = !1);
482 if (M) {
483 if (!b.swipeToNext && c < C.touches.startX || !b.swipeToPrev && c > C.touches.startX) return
484 } else if (!b.swipeToNext && d < C.touches.startY || !b.swipeToPrev && d > C.touches.startY) return;
485 if (a.assignedToSwiper) return void (C.isTouched = !1);
486 if (a.assignedToSwiper = !0, b.preventLinks && (C.allowLinks = !1), b.onSlideClick && (C.allowSlideClick = !1), b.autoplay && C.stopAutoplay(!0), !Z || 1 === a.touches.length) {
487 if (C.isMoved || (C.callPlugins("onTouchMoveStart"), b.loop && (C.fixLoop(), C.positions.start = C.getWrapperTranslate()), b.onTouchMoveStart && C.fireCallback(b.onTouchMoveStart, C)), C.isMoved = !0, a.preventDefault ? a.preventDefault() : a.returnValue = !1, C.touches.current = M ? c : d, C.positions.current = (C.touches.current - C.touches.start) * b.touchRatio + C.positions.start, C.positions.current > 0 && b.onResistanceBefore && C.fireCallback(b.onResistanceBefore, C, C.positions.current), C.positions.current < -e() && b.onResistanceAfter && C.fireCallback(b.onResistanceAfter, C, Math.abs(C.positions.current + e())), b.resistance && "100%" !== b.resistance) {
488 var f;
489 if (C.positions.current > 0 && (f = 1 - C.positions.current / I / 2, C.positions.current = .5 > f ? I / 2 : C.positions.current * f), C.positions.current < -e()) {
490 var g = (C.touches.current - C.touches.start) * b.touchRatio + (e() + C.positions.start);
491 f = (I + g) / I;
492 var h = C.positions.current - g * (1 - f) / 2,
493 i = -e() - I / 2;
494 C.positions.current = i > h || 0 >= f ? i : h
495 }
496 }
497 if (b.resistance && "100%" === b.resistance && (C.positions.current > 0 && (!b.freeMode || b.freeModeFluid) && (C.positions.current = 0), C.positions.current < -e() && (!b.freeMode || b.freeModeFluid) && (C.positions.current = -e())), !b.followFinger) return;
498 if (b.moveStartThreshold)
499 if (Math.abs(C.touches.current - C.touches.start) > b.moveStartThreshold || W) {
500 if (!W) return W = !0, void (C.touches.start = C.touches.current);
501 C.setWrapperTranslate(C.positions.current)
502 } else C.positions.current = C.positions.start;
503 else C.setWrapperTranslate(C.positions.current);
504 return (b.freeMode || b.watchActiveIndex) && C.updateActiveSlide(C.positions.current), b.grabCursor && (C.container.style.cursor = "move", C.container.style.cursor = "grabbing", C.container.style.cursor = "-moz-grabbin", C.container.style.cursor = "-webkit-grabbing"), X || (X = C.touches.current), Y || (Y = (new Date).getTime()), C.velocity = (C.touches.current - X) / ((new Date).getTime() - Y) / 2, Math.abs(C.touches.current - X) < 2 && (C.velocity = 0), X = C.touches.current, Y = (new Date).getTime(), C.callPlugins("onTouchMoveEnd"), b.onTouchMove && C.fireCallback(b.onTouchMove, C, a), !1
505 }
506 }
507 }
508
509 function r(a) {
510 if (H && C.swipeReset(), !b.onlyExternal && C.isTouched) {
511 C.isTouched = !1, b.grabCursor && (C.container.style.cursor = "move", C.container.style.cursor = "grab", C.container.style.cursor = "-moz-grab", C.container.style.cursor = "-webkit-grab"), C.positions.current || 0 === C.positions.current || (C.positions.current = C.positions.start), b.followFinger && C.setWrapperTranslate(C.positions.current), C.times.end = (new Date).getTime(), C.touches.diff = C.touches.current - C.touches.start, C.touches.abs = Math.abs(C.touches.diff), C.positions.diff = C.positions.current - C.positions.start, C.positions.abs = Math.abs(C.positions.diff);
512 var c = C.positions.diff,
513 d = C.positions.abs,
514 f = C.times.end - C.times.start;
515 5 > d && 300 > f && C.allowLinks === !1 && (b.freeMode || 0 === d || C.swipeReset(), b.preventLinks && (C.allowLinks = !0), b.onSlideClick && (C.allowSlideClick = !0)), setTimeout(function () {
516 "undefined" != typeof C && null !== C && (b.preventLinks && (C.allowLinks = !0), b.onSlideClick && (C.allowSlideClick = !0))
517 }, 100);
518 var g = e();
519 if (!C.isMoved && b.freeMode) return C.isMoved = !1, b.onTouchEnd && C.fireCallback(b.onTouchEnd, C, a), void C.callPlugins("onTouchEnd");
520 if (!C.isMoved || C.positions.current > 0 || C.positions.current < -g) return C.swipeReset(), b.onTouchEnd && C.fireCallback(b.onTouchEnd, C, a), void C.callPlugins("onTouchEnd");
521 if (C.isMoved = !1, b.freeMode) {
522 if (b.freeModeFluid) {
523 var h, i = 1e3 * b.momentumRatio,
524 j = C.velocity * i,
525 k = C.positions.current + j,
526 l = !1,
527 m = 20 * Math.abs(C.velocity) * b.momentumBounceRatio; -g > k && (b.momentumBounce && C.support.transitions ? (-m > k + g && (k = -g - m), h = -g, l = !0, $ = !0) : k = -g), k > 0 && (b.momentumBounce && C.support.transitions ? (k > m && (k = m), h = 0, l = !0, $ = !0) : k = 0), 0 !== C.velocity && (i = Math.abs((k - C.positions.current) / C.velocity)), C.setWrapperTranslate(k), C.setWrapperTransition(i), b.momentumBounce && l && C.wrapperTransitionEnd(function () {
528 $ && (b.onMomentumBounce && C.fireCallback(b.onMomentumBounce, C), C.callPlugins("onMomentumBounce"), C.setWrapperTranslate(h), C.setWrapperTransition(300))
529 }), C.updateActiveSlide(k)
530 }
531 return (!b.freeModeFluid || f >= 300) && C.updateActiveSlide(C.positions.current), b.onTouchEnd && C.fireCallback(b.onTouchEnd, C, a), void C.callPlugins("onTouchEnd")
532 }
533 G = 0 > c ? "toNext" : "toPrev", "toNext" === G && 300 >= f && (30 > d || !b.shortSwipes ? C.swipeReset() : C.swipeNext(!0)), "toPrev" === G && 300 >= f && (30 > d || !b.shortSwipes ? C.swipeReset() : C.swipePrev(!0));
534 var n = 0;
535 if ("auto" === b.slidesPerView) {
536 for (var o, p = Math.abs(C.getWrapperTranslate()), q = 0, r = 0; r < C.slides.length; r++)
537 if (o = M ? C.slides[r].getWidth(!0, b.roundLengths) : C.slides[r].getHeight(!0, b.roundLengths), q += o, q > p) {
538 n = o;
539 break
540 }
541 n > I && (n = I)
542 } else n = E * b.slidesPerView;
543 "toNext" === G && f > 300 && (d >= n * b.longSwipesRatio ? C.swipeNext(!0) : C.swipeReset()), "toPrev" === G && f > 300 && (d >= n * b.longSwipesRatio ? C.swipePrev(!0) : C.swipeReset()), b.onTouchEnd && C.fireCallback(b.onTouchEnd, C, a), C.callPlugins("onTouchEnd")
544 }
545 }
546
547 function s(a) {
548 var c = !1;
549 do a.className.indexOf(b.noSwipingClass) > -1 && (c = !0), a = a.parentElement; while (!c && a.parentElement && -1 === a.className.indexOf(b.wrapperClass));
550 return !c && a.className.indexOf(b.wrapperClass) > -1 && a.className.indexOf(b.noSwipingClass) > -1 && (c = !0), c
551 }
552
553 function t(a, b) {
554 var c, d = document.createElement("div");
555 return d.innerHTML = b, c = d.firstChild, c.className += " " + a, c.outerHTML
556 }
557
558 function u(a, c, d) {
559 function e() {
560 var f = +new Date,
561 l = f - g;
562 h += i * l / (1e3 / 60), k = "toNext" === j ? h > a : a > h, k ? (C.setWrapperTranslate(Math.ceil(h)), C._DOMAnimating = !0, window.setTimeout(function () {
563 e()
564 }, 1e3 / 60)) : (b.onSlideChangeEnd && ("to" === c ? d.runCallbacks === !0 && C.fireCallback(b.onSlideChangeEnd, C, j) : C.fireCallback(b.onSlideChangeEnd, C, j)), C.setWrapperTranslate(a), C._DOMAnimating = !1)
565 }
566 var f = "to" === c && d.speed >= 0 ? d.speed : b.speed,
567 g = +new Date;
568 if (C.support.transitions || !b.DOMAnimation) C.setWrapperTranslate(a), C.setWrapperTransition(f);
569 else {
570 var h = C.getWrapperTranslate(),
571 i = Math.ceil((a - h) / f * (1e3 / 60)),
572 j = h > a ? "toNext" : "toPrev",
573 k = "toNext" === j ? h > a : a > h;
574 if (C._DOMAnimating) return;
575 e()
576 }
577 C.updateActiveSlide(a), b.onSlideNext && "next" === c && C.fireCallback(b.onSlideNext, C, a), b.onSlidePrev && "prev" === c && C.fireCallback(b.onSlidePrev, C, a), b.onSlideReset && "reset" === c && C.fireCallback(b.onSlideReset, C, a), ("next" === c || "prev" === c || "to" === c && d.runCallbacks === !0) && v(c)
578 }
579
580 function v(a) {
581 if (C.callPlugins("onSlideChangeStart"), b.onSlideChangeStart)
582 if (b.queueStartCallbacks && C.support.transitions) {
583 if (C._queueStartCallbacks) return;
584 C._queueStartCallbacks = !0, C.fireCallback(b.onSlideChangeStart, C, a), C.wrapperTransitionEnd(function () {
585 C._queueStartCallbacks = !1
586 })
587 } else C.fireCallback(b.onSlideChangeStart, C, a);
588 if (b.onSlideChangeEnd)
589 if (C.support.transitions)
590 if (b.queueEndCallbacks) {
591 if (C._queueEndCallbacks) return;
592 C._queueEndCallbacks = !0, C.wrapperTransitionEnd(function (c) {
593 C.fireCallback(b.onSlideChangeEnd, c, a)
594 })
595 } else C.wrapperTransitionEnd(function (c) {
596 C.fireCallback(b.onSlideChangeEnd, c, a)
597 });
598 else b.DOMAnimation || setTimeout(function () {
599 C.fireCallback(b.onSlideChangeEnd, C, a)
600 }, 10)
601 }
602
603 function w() {
604 var a = C.paginationButtons;
605 if (a)
606 for (var b = 0; b < a.length; b++) C.h.removeEventListener(a[b], "click", y)
607 }
608
609 function x() {
610 var a = C.paginationButtons;
611 if (a)
612 for (var b = 0; b < a.length; b++) C.h.addEventListener(a[b], "click", y)
613 }
614
615 function y(a) {
616 for (var c, d = a.target || a.srcElement, e = C.paginationButtons, f = 0; f < e.length; f++) d === e[f] && (c = f);
617 b.autoplay && C.stopAutoplay(!0), C.swipeTo(c)
618 }
619
620 function z() {
621 _ = setTimeout(function () {
622 b.loop ? (C.fixLoop(), C.swipeNext(!0)) : C.swipeNext(!0) || (b.autoplayStopOnLast ? (clearTimeout(_), _ = void 0) : C.swipeTo(0)), C.wrapperTransitionEnd(function () {
623 "undefined" != typeof _ && z()
624 })
625 }, b.autoplay)
626 }
627
628 function A() {
629 C.calcSlides(), b.loader.slides.length > 0 && 0 === C.slides.length && C.loadSlides(), b.loop && C.createLoop(), C.init(), f(), b.pagination && C.createPagination(!0), b.loop || b.initialSlide > 0 ? C.swipeTo(b.initialSlide, 0, !1) : C.updateActiveSlide(0), b.autoplay && C.startAutoplay(), C.centerIndex = C.activeIndex, b.onSwiperCreated && C.fireCallback(b.onSwiperCreated, C), C.callPlugins("onSwiperCreated")
630 }
631 if (!document.body.outerHTML && document.body.__defineGetter__ && HTMLElement) {
632 var B = HTMLElement.prototype;
633 B.__defineGetter__ && B.__defineGetter__("outerHTML", function () {
634 return (new XMLSerializer).serializeToString(this)
635 })
636 }
637 if (window.getComputedStyle || (window.getComputedStyle = function (a) {
638 return this.el = a, this.getPropertyValue = function (b) {
639 var c = /(\-([a-z]){1})/g;
640 return "float" === b && (b = "styleFloat"), c.test(b) && (b = b.replace(c, function () {
641 return arguments[2].toUpperCase()
642 })), a.currentStyle[b] ? a.currentStyle[b] : null
643 }, this
644 }), Array.prototype.indexOf || (Array.prototype.indexOf = function (a, b) {
645 for (var c = b || 0, d = this.length; d > c; c++)
646 if (this[c] === a) return c;
647 return -1
648 }), (document.querySelectorAll || window.jQuery) && "undefined" != typeof a && (a.nodeType || 0 !== c(a).length)) {
649 var C = this;
650 C.touches = {
651 start: 0,
652 startX: 0,
653 startY: 0,
654 current: 0,
655 currentX: 0,
656 currentY: 0,
657 diff: 0,
658 abs: 0
659 }, C.positions = {
660 start: 0,
661 abs: 0,
662 diff: 0,
663 current: 0
664 }, C.times = {
665 start: 0,
666 end: 0
667 }, C.id = (new Date).getTime(), C.container = a.nodeType ? a : c(a)[0], C.isTouched = !1, C.isMoved = !1, C.activeIndex = 0, C.centerIndex = 0, C.activeLoaderIndex = 0, C.activeLoopIndex = 0, C.previousIndex = null, C.velocity = 0, C.snapGrid = [], C.slidesGrid = [], C.imagesToLoad = [], C.imagesLoaded = 0, C.wrapperLeft = 0, C.wrapperRight = 0, C.wrapperTop = 0, C.wrapperBottom = 0, C.isAndroid = navigator.userAgent.toLowerCase().indexOf("android") >= 0;
668 var D, E, F, G, H, I, J = {
669 eventTarget: "wrapper",
670 mode: "horizontal",
671 touchRatio: 1,
672 speed: 300,
673 freeMode: !1,
674 freeModeFluid: !1,
675 momentumRatio: 1,
676 momentumBounce: !0,
677 momentumBounceRatio: 1,
678 slidesPerView: 1,
679 slidesPerGroup: 1,
680 slidesPerViewFit: !0,
681 simulateTouch: !0,
682 followFinger: !0,
683 shortSwipes: !0,
684 longSwipesRatio: .5,
685 moveStartThreshold: !1,
686 onlyExternal: !1,
687 createPagination: !0,
688 pagination: !1,
689 paginationElement: "span",
690 paginationClickable: !1,
691 paginationAsRange: !0,
692 resistance: !0,
693 scrollContainer: !1,
694 preventLinks: !0,
695 preventLinksPropagation: !1,
696 noSwiping: !1,
697 noSwipingClass: "swiper-no-swiping",
698 initialSlide: 0,
699 keyboardControl: !1,
700 mousewheelControl: !1,
701 mousewheelControlForceToAxis: !1,
702 useCSS3Transforms: !0,
703 autoplay: !1,
704 autoplayDisableOnInteraction: !0,
705 autoplayStopOnLast: !1,
706 loop: !1,
707 loopAdditionalSlides: 0,
708 roundLengths: !1,
709 calculateHeight: !1,
710 cssWidthAndHeight: !1,
711 updateOnImagesReady: !0,
712 releaseFormElements: !0,
713 watchActiveIndex: !1,
714 visibilityFullFit: !1,
715 offsetPxBefore: 0,
716 offsetPxAfter: 0,
717 offsetSlidesBefore: 0,
718 offsetSlidesAfter: 0,
719 centeredSlides: !1,
720 queueStartCallbacks: !1,
721 queueEndCallbacks: !1,
722 autoResize: !0,
723 resizeReInit: !1,
724 DOMAnimation: !0,
725 loader: {
726 slides: [],
727 slidesHTMLType: "inner",
728 surroundGroups: 1,
729 logic: "reload",
730 loadAllSlides: !1
731 },
732 swipeToPrev: !0,
733 swipeToNext: !0,
734 slideElement: "div",
735 slideClass: "swiper-slide",
736 slideActiveClass: "swiper-slide-active",
737 slideVisibleClass: "swiper-slide-visible",
738 slideDuplicateClass: "swiper-slide-duplicate",
739 wrapperClass: "swiper-wrapper",
740 paginationElementClass: "swiper-pagination-switch",
741 paginationActiveClass: "swiper-active-switch",
742 paginationVisibleClass: "swiper-visible-switch"
743 };
744 b = b || {};
745 for (var K in J)
746 if (K in b && "object" == typeof b[K])
747 for (var L in J[K]) L in b[K] || (b[K][L] = J[K][L]);
748 else K in b || (b[K] = J[K]);
749 C.params = b, b.scrollContainer && (b.freeMode = !0, b.freeModeFluid = !0), b.loop && (b.resistance = "100%");
750 var M = "horizontal" === b.mode,
751 N = ["mousedown", "mousemove", "mouseup"];
752 C.browser.ie10 && (N = ["MSPointerDown", "MSPointerMove", "MSPointerUp"]), C.browser.ie11 && (N = ["pointerdown", "pointermove", "pointerup"]), C.touchEvents = {
753 touchStart: C.support.touch || !b.simulateTouch ? "touchstart" : N[0],
754 touchMove: C.support.touch || !b.simulateTouch ? "touchmove" : N[1],
755 touchEnd: C.support.touch || !b.simulateTouch ? "touchend" : N[2]
756 };
757 for (var O = C.container.childNodes.length - 1; O >= 0; O--)
758 if (C.container.childNodes[O].className)
759 for (var P = C.container.childNodes[O].className.split(/\s+/), Q = 0; Q < P.length; Q++) P[Q] === b.wrapperClass && (D = C.container.childNodes[O]);
760 C.wrapper = D, C._extendSwiperSlide = function (a) {
761 return a.append = function () {
762 return b.loop ? a.insertAfter(C.slides.length - C.loopedSlides) : (C.wrapper.appendChild(a), C.reInit()), a
763 }, a.prepend = function () {
764 return b.loop ? (C.wrapper.insertBefore(a, C.slides[C.loopedSlides]), C.removeLoopedSlides(), C.calcSlides(), C.createLoop()) : C.wrapper.insertBefore(a, C.wrapper.firstChild), C.reInit(), a
765 }, a.insertAfter = function (c) {
766 if ("undefined" == typeof c) return !1;
767 var d;
768 return b.loop ? (d = C.slides[c + 1 + C.loopedSlides], d ? C.wrapper.insertBefore(a, d) : C.wrapper.appendChild(a), C.removeLoopedSlides(), C.calcSlides(), C.createLoop()) : (d = C.slides[c + 1], C.wrapper.insertBefore(a, d)), C.reInit(), a
769 }, a.clone = function () {
770 return C._extendSwiperSlide(a.cloneNode(!0))
771 }, a.remove = function () {
772 C.wrapper.removeChild(a), C.reInit()
773 }, a.html = function (b) {
774 return "undefined" == typeof b ? a.innerHTML : (a.innerHTML = b, a)
775 }, a.index = function () {
776 for (var b, c = C.slides.length - 1; c >= 0; c--) a === C.slides[c] && (b = c);
777 return b
778 }, a.isActive = function () {
779 return a.index() === C.activeIndex ? !0 : !1
780 }, a.swiperSlideDataStorage || (a.swiperSlideDataStorage = {}), a.getData = function (b) {
781 return a.swiperSlideDataStorage[b]
782 }, a.setData = function (b, c) {
783 return a.swiperSlideDataStorage[b] = c, a
784 }, a.data = function (b, c) {
785 return "undefined" == typeof c ? a.getAttribute("data-" + b) : (a.setAttribute("data-" + b, c), a)
786 }, a.getWidth = function (b, c) {
787 return C.h.getWidth(a, b, c)
788 }, a.getHeight = function (b, c) {
789 return C.h.getHeight(a, b, c)
790 }, a.getOffset = function () {
791 return C.h.getOffset(a)
792 }, a
793 }, C.calcSlides = function (a) {
794 var c = C.slides ? C.slides.length : !1;
795 C.slides = [], C.displaySlides = [];
796 for (var d = 0; d < C.wrapper.childNodes.length; d++)
797 if (C.wrapper.childNodes[d].className)
798 for (var e = C.wrapper.childNodes[d].className, f = e.split(/\s+/), i = 0; i < f.length; i++) f[i] === b.slideClass && C.slides.push(C.wrapper.childNodes[d]);
799 for (d = C.slides.length - 1; d >= 0; d--) C._extendSwiperSlide(C.slides[d]);
800 c !== !1 && (c !== C.slides.length || a) && (h(), g(), C.updateActiveSlide(), C.params.pagination && C.createPagination(), C.callPlugins("numberOfSlidesChanged"))
801 }, C.createSlide = function (a, c, d) {
802 c = c || C.params.slideClass, d = d || b.slideElement;
803 var e = document.createElement(d);
804 return e.innerHTML = a || "", e.className = c, C._extendSwiperSlide(e)
805 }, C.appendSlide = function (a, b, c) {
806 return a ? a.nodeType ? C._extendSwiperSlide(a).append() : C.createSlide(a, b, c).append() : void 0
807 }, C.prependSlide = function (a, b, c) {
808 return a ? a.nodeType ? C._extendSwiperSlide(a).prepend() : C.createSlide(a, b, c).prepend() : void 0
809 }, C.insertSlideAfter = function (a, b, c, d) {
810 return "undefined" == typeof a ? !1 : b.nodeType ? C._extendSwiperSlide(b).insertAfter(a) : C.createSlide(b, c, d).insertAfter(a)
811 }, C.removeSlide = function (a) {
812 if (C.slides[a]) {
813 if (b.loop) {
814 if (!C.slides[a + C.loopedSlides]) return !1;
815 C.slides[a + C.loopedSlides].remove(), C.removeLoopedSlides(), C.calcSlides(), C.createLoop()
816 } else C.slides[a].remove();
817 return !0
818 }
819 return !1
820 }, C.removeLastSlide = function () {
821 return C.slides.length > 0 ? (b.loop ? (C.slides[C.slides.length - 1 - C.loopedSlides].remove(), C.removeLoopedSlides(), C.calcSlides(), C.createLoop()) : C.slides[C.slides.length - 1].remove(), !0) : !1
822 }, C.removeAllSlides = function () {
823 for (var a = C.slides.length - 1; a >= 0; a--) C.slides[a].remove()
824 }, C.getSlide = function (a) {
825 return C.slides[a]
826 }, C.getLastSlide = function () {
827 return C.slides[C.slides.length - 1]
828 }, C.getFirstSlide = function () {
829 return C.slides[0]
830 }, C.activeSlide = function () {
831 return C.slides[C.activeIndex]
832 }, C.fireCallback = function () {
833 var a = arguments[0];
834 if ("[object Array]" === Object.prototype.toString.call(a))
835 for (var c = 0; c < a.length; c++) "function" == typeof a[c] && a[c](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
836 else "[object String]" === Object.prototype.toString.call(a) ? b["on" + a] && C.fireCallback(b["on" + a], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]) : a(arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])
837 }, C.addCallback = function (a, b) {
838 var c, e = this;
839 return e.params["on" + a] ? d(this.params["on" + a]) ? this.params["on" + a].push(b) : "function" == typeof this.params["on" + a] ? (c = this.params["on" + a], this.params["on" + a] = [], this.params["on" + a].push(c), this.params["on" + a].push(b)) : void 0 : (this.params["on" + a] = [], this.params["on" + a].push(b))
840 }, C.removeCallbacks = function (a) {
841 C.params["on" + a] && (C.params["on" + a] = null)
842 };
843 var R = [];
844 for (var S in C.plugins)
845 if (b[S]) {
846 var T = C.plugins[S](C, b[S]);
847 T && R.push(T)
848 }
849 C.callPlugins = function (a, b) {
850 b || (b = {});
851 for (var c = 0; c < R.length; c++) a in R[c] && R[c][a](b)
852 }, !C.browser.ie10 && !C.browser.ie11 || b.onlyExternal || C.wrapper.classList.add("swiper-wp8-" + (M ? "horizontal" : "vertical")), b.freeMode && (C.container.className += " swiper-free-mode"), C.initialized = !1, C.init = function (a, c) {
853 var d = C.h.getWidth(C.container, !1, b.roundLengths),
854 e = C.h.getHeight(C.container, !1, b.roundLengths);
855 if (d !== C.width || e !== C.height || a) {
856 C.width = d, C.height = e;
857 var f, g, h, i, j, k, l;
858 I = M ? d : e;
859 var m = C.wrapper;
860 if (a && C.calcSlides(c), "auto" === b.slidesPerView) {
861 var n = 0,
862 o = 0;
863 b.slidesOffset > 0 && (m.style.paddingLeft = "", m.style.paddingRight = "", m.style.paddingTop = "", m.style.paddingBottom = ""), m.style.width = "", m.style.height = "", b.offsetPxBefore > 0 && (M ? C.wrapperLeft = b.offsetPxBefore : C.wrapperTop = b.offsetPxBefore), b.offsetPxAfter > 0 && (M ? C.wrapperRight = b.offsetPxAfter : C.wrapperBottom = b.offsetPxAfter), b.centeredSlides && (M ? (C.wrapperLeft = (I - this.slides[0].getWidth(!0, b.roundLengths)) / 2, C.wrapperRight = (I - C.slides[C.slides.length - 1].getWidth(!0, b.roundLengths)) / 2) : (C.wrapperTop = (I - C.slides[0].getHeight(!0, b.roundLengths)) / 2, C.wrapperBottom = (I - C.slides[C.slides.length - 1].getHeight(!0, b.roundLengths)) / 2)), M ? (C.wrapperLeft >= 0 && (m.style.paddingLeft = C.wrapperLeft + "px"), C.wrapperRight >= 0 && (m.style.paddingRight = C.wrapperRight + "px")) : (C.wrapperTop >= 0 && (m.style.paddingTop = C.wrapperTop + "px"), C.wrapperBottom >= 0 && (m.style.paddingBottom = C.wrapperBottom + "px")), k = 0;
864 var p = 0;
865 for (C.snapGrid = [], C.slidesGrid = [], h = 0, l = 0; l < C.slides.length; l++) {
866 f = C.slides[l].getWidth(!0, b.roundLengths), g = C.slides[l].getHeight(!0, b.roundLengths), b.calculateHeight && (h = Math.max(h, g));
867 var q = M ? f : g;
868 if (b.centeredSlides) {
869 var r = l === C.slides.length - 1 ? 0 : C.slides[l + 1].getWidth(!0, b.roundLengths),
870 s = l === C.slides.length - 1 ? 0 : C.slides[l + 1].getHeight(!0, b.roundLengths),
871 t = M ? r : s;
872 if (q > I) {
873 if (b.slidesPerViewFit) C.snapGrid.push(k + C.wrapperLeft), C.snapGrid.push(k + q - I + C.wrapperLeft);
874 else
875 for (var u = 0; u <= Math.floor(q / (I + C.wrapperLeft)); u++) C.snapGrid.push(0 === u ? k + C.wrapperLeft : k + C.wrapperLeft + I * u);
876 C.slidesGrid.push(k + C.wrapperLeft)
877 } else C.snapGrid.push(p), C.slidesGrid.push(p);
878 p += q / 2 + t / 2
879 } else {
880 if (q > I)
881 if (b.slidesPerViewFit) C.snapGrid.push(k), C.snapGrid.push(k + q - I);
882 else if (0 !== I)
883 for (var v = 0; v <= Math.floor(q / I); v++) C.snapGrid.push(k + I * v);
884 else C.snapGrid.push(k);
885 else C.snapGrid.push(k);
886 C.slidesGrid.push(k)
887 }
888 k += q, n += f, o += g
889 }
890 b.calculateHeight && (C.height = h), M ? (F = n + C.wrapperRight + C.wrapperLeft, m.style.width = n + "px", m.style.height = C.height + "px") : (F = o + C.wrapperTop + C.wrapperBottom, m.style.width = C.width + "px", m.style.height = o + "px")
891 } else if (b.scrollContainer) m.style.width = "", m.style.height = "", i = C.slides[0].getWidth(!0, b.roundLengths), j = C.slides[0].getHeight(!0, b.roundLengths), F = M ? i : j, m.style.width = i + "px", m.style.height = j + "px", E = M ? i : j;
892 else {
893 if (b.calculateHeight) {
894 for (h = 0, j = 0, M || (C.container.style.height = ""), m.style.height = "", l = 0; l < C.slides.length; l++) C.slides[l].style.height = "", h = Math.max(C.slides[l].getHeight(!0), h), M || (j += C.slides[l].getHeight(!0));
895 g = h, C.height = g, M ? j = g : (I = g, C.container.style.height = I + "px")
896 } else g = M ? C.height : C.height / b.slidesPerView, b.roundLengths && (g = Math.ceil(g)), j = M ? C.height : C.slides.length * g;
897 for (f = M ? C.width / b.slidesPerView : C.width, b.roundLengths && (f = Math.ceil(f)), i = M ? C.slides.length * f : C.width, E = M ? f : g, b.offsetSlidesBefore > 0 && (M ? C.wrapperLeft = E * b.offsetSlidesBefore : C.wrapperTop = E * b.offsetSlidesBefore), b.offsetSlidesAfter > 0 && (M ? C.wrapperRight = E * b.offsetSlidesAfter : C.wrapperBottom = E * b.offsetSlidesAfter), b.offsetPxBefore > 0 && (M ? C.wrapperLeft = b.offsetPxBefore : C.wrapperTop = b.offsetPxBefore), b.offsetPxAfter > 0 && (M ? C.wrapperRight = b.offsetPxAfter : C.wrapperBottom = b.offsetPxAfter), b.centeredSlides && (M ? (C.wrapperLeft = (I - E) / 2, C.wrapperRight = (I - E) / 2) : (C.wrapperTop = (I - E) / 2, C.wrapperBottom = (I - E) / 2)), M ? (C.wrapperLeft > 0 && (m.style.paddingLeft = C.wrapperLeft + "px"), C.wrapperRight > 0 && (m.style.paddingRight = C.wrapperRight + "px")) : (C.wrapperTop > 0 && (m.style.paddingTop = C.wrapperTop + "px"), C.wrapperBottom > 0 && (m.style.paddingBottom = C.wrapperBottom + "px")), F = M ? i + C.wrapperRight + C.wrapperLeft : j + C.wrapperTop + C.wrapperBottom, parseFloat(i) > 0 && (!b.cssWidthAndHeight || "height" === b.cssWidthAndHeight) && (m.style.width = i + "px"), parseFloat(j) > 0 && (!b.cssWidthAndHeight || "width" === b.cssWidthAndHeight) && (m.style.height = j + "px"), k = 0, C.snapGrid = [], C.slidesGrid = [], l = 0; l < C.slides.length; l++) C.snapGrid.push(k), C.slidesGrid.push(k), k += E, parseFloat(f) > 0 && (!b.cssWidthAndHeight || "height" === b.cssWidthAndHeight) && (C.slides[l].style.width = f + "px"), parseFloat(g) > 0 && (!b.cssWidthAndHeight || "width" === b.cssWidthAndHeight) && (C.slides[l].style.height = g + "px")
898 }
899 C.initialized ? (C.callPlugins("onInit"), b.onInit && C.fireCallback(b.onInit, C)) : (C.callPlugins("onFirstInit"), b.onFirstInit && C.fireCallback(b.onFirstInit, C)), C.initialized = !0
900 }
901 }, C.reInit = function (a) {
902 C.init(!0, a)
903 }, C.resizeFix = function (a) {
904 C.callPlugins("beforeResizeFix"), C.init(b.resizeReInit || a), b.freeMode ? C.getWrapperTranslate() < -e() && (C.setWrapperTransition(0), C.setWrapperTranslate(-e())) : (C.swipeTo(b.loop ? C.activeLoopIndex : C.activeIndex, 0, !1), b.autoplay && (C.support.transitions && "undefined" != typeof _ ? "undefined" != typeof _ && (clearTimeout(_), _ = void 0, C.startAutoplay()) : "undefined" != typeof ab && (clearInterval(ab), ab = void 0, C.startAutoplay()))), C.callPlugins("afterResizeFix")
905 }, C.destroy = function () {
906 var a = C.h.removeEventListener,
907 c = "wrapper" === b.eventTarget ? C.wrapper : C.container;
908 C.browser.ie10 || C.browser.ie11 ? (a(c, C.touchEvents.touchStart, p), a(document, C.touchEvents.touchMove, q), a(document, C.touchEvents.touchEnd, r)) : (C.support.touch && (a(c, "touchstart", p), a(c, "touchmove", q), a(c, "touchend", r)), b.simulateTouch && (a(c, "mousedown", p), a(document, "mousemove", q), a(document, "mouseup", r))), b.autoResize && a(window, "resize", C.resizeFix), h(), b.paginationClickable && w(), b.mousewheelControl && C._wheelEvent && a(C.container, C._wheelEvent, j), b.keyboardControl && a(document, "keydown", i), b.autoplay && C.stopAutoplay(), C.callPlugins("onDestroy"), C = null
909 }, C.disableKeyboardControl = function () {
910 b.keyboardControl = !1, C.h.removeEventListener(document, "keydown", i)
911 }, C.enableKeyboardControl = function () {
912 b.keyboardControl = !0, C.h.addEventListener(document, "keydown", i)
913 };
914 var U = (new Date).getTime();
915 if (C.disableMousewheelControl = function () {
916 return C._wheelEvent ? (b.mousewheelControl = !1, C.h.removeEventListener(C.container, C._wheelEvent, j), !0) : !1
917 }, C.enableMousewheelControl = function () {
918 return C._wheelEvent ? (b.mousewheelControl = !0, C.h.addEventListener(C.container, C._wheelEvent, j), !0) : !1
919 }, b.grabCursor) {
920 var V = C.container.style;
921 V.cursor = "move", V.cursor = "grab", V.cursor = "-moz-grab", V.cursor = "-webkit-grab"
922 }
923 C.allowSlideClick = !0, C.allowLinks = !0;
924 var W, X, Y, Z = !1,
925 $ = !0;
926 C.swipeNext = function (a) {
927 !a && b.loop && C.fixLoop(), !a && b.autoplay && C.stopAutoplay(!0), C.callPlugins("onSwipeNext");
928 var c = C.getWrapperTranslate(),
929 d = c;
930 if ("auto" === b.slidesPerView) {
931 for (var f = 0; f < C.snapGrid.length; f++)
932 if (-c >= C.snapGrid[f] && -c < C.snapGrid[f + 1]) {
933 d = -C.snapGrid[f + 1];
934 break
935 }
936 } else {
937 var g = E * b.slidesPerGroup;
938 d = -(Math.floor(Math.abs(c) / Math.floor(g)) * g + g)
939 }
940 return d < -e() && (d = -e()), d === c ? !1 : (u(d, "next"), !0)
941 }, C.swipePrev = function (a) {
942 !a && b.loop && C.fixLoop(), !a && b.autoplay && C.stopAutoplay(!0), C.callPlugins("onSwipePrev");
943 var c, d = Math.ceil(C.getWrapperTranslate());
944 if ("auto" === b.slidesPerView) {
945 c = 0;
946 for (var e = 1; e < C.snapGrid.length; e++) {
947 if (-d === C.snapGrid[e]) {
948 c = -C.snapGrid[e - 1];
949 break
950 }
951 if (-d > C.snapGrid[e] && -d < C.snapGrid[e + 1]) {
952 c = -C.snapGrid[e];
953 break
954 }
955 }
956 } else {
957 var f = E * b.slidesPerGroup;
958 c = -(Math.ceil(-d / f) - 1) * f
959 }
960 return c > 0 && (c = 0), c === d ? !1 : (u(c, "prev"), !0)
961 }, C.swipeReset = function () {
962 C.callPlugins("onSwipeReset");
963 {
964 var a, c = C.getWrapperTranslate(),
965 d = E * b.slidesPerGroup; -e()
966 }
967 if ("auto" === b.slidesPerView) {
968 a = 0;
969 for (var f = 0; f < C.snapGrid.length; f++) {
970 if (-c === C.snapGrid[f]) return;
971 if (-c >= C.snapGrid[f] && -c < C.snapGrid[f + 1]) {
972 a = C.positions.diff > 0 ? -C.snapGrid[f + 1] : -C.snapGrid[f];
973 break
974 }
975 } -c >= C.snapGrid[C.snapGrid.length - 1] && (a = -C.snapGrid[C.snapGrid.length - 1]), c <= -e() && (a = -e())
976 } else a = 0 > c ? Math.round(c / d) * d : 0, c <= -e() && (a = -e());
977 return b.scrollContainer && (a = 0 > c ? c : 0), a < -e() && (a = -e()), b.scrollContainer && I > E && (a = 0), a === c ? !1 : (u(a, "reset"), !0)
978 }, C.swipeTo = function (a, c, d) {
979 a = parseInt(a, 10), C.callPlugins("onSwipeTo", {
980 index: a,
981 speed: c
982 }), b.loop && (a += C.loopedSlides);
983 var f = C.getWrapperTranslate();
984 if (!(a > C.slides.length - 1 || 0 > a)) {
985 var g;
986 return g = "auto" === b.slidesPerView ? -C.slidesGrid[a] : -a * E, g < -e() && (g = -e()), g === f ? !1 : (d = d === !1 ? !1 : !0, u(g, "to", {
987 index: a,
988 speed: c,
989 runCallbacks: d
990 }), !0)
991 }
992 }, C._queueStartCallbacks = !1, C._queueEndCallbacks = !1, C.updateActiveSlide = function (a) {
993 if (C.initialized && 0 !== C.slides.length) {
994 C.previousIndex = C.activeIndex, "undefined" == typeof a && (a = C.getWrapperTranslate()), a > 0 && (a = 0);
995 var c;
996 if ("auto" === b.slidesPerView) {
997 if (C.activeIndex = C.slidesGrid.indexOf(-a), C.activeIndex < 0) {
998 for (c = 0; c < C.slidesGrid.length - 1 && !(-a > C.slidesGrid[c] && -a < C.slidesGrid[c + 1]); c++);
999 var d = Math.abs(C.slidesGrid[c] + a),
1000 e = Math.abs(C.slidesGrid[c + 1] + a);
1001 C.activeIndex = e >= d ? c : c + 1
1002 }
1003
View Code
如果等滚动条拉到底部时再加载,会影响用户体验。一般动态加载的时候都需要向服务端请求资源,这时需要时间。一个更佳的方式是,
当滚动条距离浏览器底部存在一定距离(beforehandHeight)时,就动态加载更多数据,向服务端请求资源。也就是预加载。
那么上面的 2或者3 的滚动方式 的判断 if 条件就需要改成: sum - beforehandHeight <= $obj.scrollTop() + $obj.height() 或者: this.scrollHeight - beforehandHeight <= $(this).scrollTop() + $(this).height()
例如:当滚动条 离浏览器底部 还有50px时 就需要 加载数据(或者处理其他逻辑),那么 上面的 2或者3 的 判断 if 条件就 需要改成: sum - 50<= $obj.scrollTop() + $obj.height() 或者: this.scrollHeight - 50<= $(this).scrollTop() + $(this).height()