1 2/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */ 3(function(g, q, f) { 4 function p(a, b) { 5 this.wrapper = "string" == typeof a ? q.querySelector(a) : a; 6 this.scroller = this.wrapper.children[0]; 7 this.scrollerStyle = this.scroller.style; 8 this.options = { 9 resizeScrollbars: !0, 10 mouseWheelSpeed: 20, 11 snapThreshold: .334, 12 disablePointer: !d.hasPointer, 13 disableTouch: d.hasPointer || !d.hasTouch, 14 disableMouse: d.hasPointer || d.hasTouch, 15 startX: 0, 16 startY: 0, 17 scrollY: !0, 18 directionLockThreshold: 5, 19 momentum: !0, 20 bounce: !0, 21 bounceTime: 600, 22 bounceEasing: "", 23 preventDefault: !0, 24 preventDefaultException: { 25 tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ 26 }, 27 HWCompositing: !0, 28 useTransition: !0, 29 useTransform: !0, 30 bindToWrapper: "undefined" === typeof g.onmousedown 31 }; 32 for (var c in b) this.options[c] = b[c]; 33 this.translateZ = this.options.HWCompositing && d.hasPerspective ? " translateZ(0)" : ""; 34 this.options.useTransition = d.hasTransition && this.options.useTransition; 35 this.options.useTransform = d.hasTransform && this.options.useTransform; 36 this.options.eventPassthrough = !0 === this.options.eventPassthrough ? "vertical" : this.options.eventPassthrough; 37 this.options.preventDefault = !this.options.eventPassthrough && 38 this.options.preventDefault; 39 this.options.scrollY = "vertical" == this.options.eventPassthrough ? !1 : this.options.scrollY; 40 this.options.scrollX = "horizontal" == this.options.eventPassthrough ? !1 : this.options.scrollX; 41 this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough; 42 this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold; 43 this.options.bounceEasing = "string" == typeof this.options.bounceEasing ? d.ease[this.options.bounceEasing] || d.ease.circular : 44 this.options.bounceEasing; 45 this.options.resizePolling = void 0 === this.options.resizePolling ? 60 : this.options.resizePolling; 46 !0 === this.options.tap && (this.options.tap = "tap"); 47 this.options.useTransition || this.options.useTransform || /relative|absolute/i.test(this.scrollerStyle.position) || (this.scrollerStyle.position = "relative"); 48 "scale" == this.options.shrinkScrollbars && (this.options.useTransition = !1); 49 this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1; 50 this.directionY = this.directionX = this.y = 51 this.x = 0; 52 this._events = {}; 53 this._init(); 54 this.refresh(); 55 this.scrollTo(this.options.startX, this.options.startY); 56 this.enable() 57 } 58 59 function u(a, b, c) { 60 var e = q.createElement("div"), 61 d = q.createElement("div"); 62 !0 === c && (e.style.cssText = "position:absolute;z-index:9999", d.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"); 63 d.className = "iScrollIndicator"; 64 "h" == a ? (!0 === c && (e.style.cssText += 65 ";height:7px;left:2px;right:2px;bottom:0", d.style.height = "100%"), e.className = "iScrollHorizontalScrollbar") : (!0 === c && (e.style.cssText += ";width:7px;bottom:2px;top:2px;right:1px", d.style.width = "100%"), e.className = "iScrollVerticalScrollbar"); 66 e.style.cssText += ";overflow:hidden"; 67 b || (e.style.pointerEvents = "none"); 68 e.appendChild(d); 69 return e 70 } 71 72 function v(a, b) { 73 this.wrapper = "string" == typeof b.el ? q.querySelector(b.el) : b.el; 74 this.wrapperStyle = this.wrapper.style; 75 this.indicator = this.wrapper.children[0]; 76 this.indicatorStyle = 77 this.indicator.style; 78 this.scroller = a; 79 this.options = { 80 listenX: !0, 81 listenY: !0, 82 interactive: !1, 83 resize: !0, 84 defaultScrollbars: !1, 85 shrink: !1, 86 fade: !1, 87 speedRatioX: 0, 88 speedRatioY: 0 89 }; 90 for (var c in b) this.options[c] = b[c]; 91 this.sizeRatioY = this.sizeRatioX = 1; 92 this.maxPosY = this.maxPosX = 0; 93 this.options.interactive && (this.options.disableTouch || (d.addEvent(this.indicator, "touchstart", this), d.addEvent(g, "touchend", this)), this.options.disablePointer || (d.addEvent(this.indicator, d.prefixPointerEvent("pointerdown"), this), d.addEvent(g, 94 d.prefixPointerEvent("pointerup"), this)), this.options.disableMouse || (d.addEvent(this.indicator, "mousedown", this), d.addEvent(g, "mouseup", this))); 95 if (this.options.fade) { 96 this.wrapperStyle[d.style.transform] = this.scroller.translateZ; 97 var e = d.style.transitionDuration; 98 if (e) { 99 this.wrapperStyle[e] = d.isBadAndroid ? "0.0001ms" : "0ms"; 100 var f = this; 101 d.isBadAndroid && t(function() { 102 "0.0001ms" === f.wrapperStyle[e] && (f.wrapperStyle[e] = "0s") 103 }); 104 this.wrapperStyle.opacity = "0" 105 } 106 } 107 } 108 var t = g.requestAnimationFrame || g.webkitRequestAnimationFrame || 109 g.mozRequestAnimationFrame || g.oRequestAnimationFrame || g.msRequestAnimationFrame || function(a) { 110 g.setTimeout(a, 1E3 / 60) 111 }, 112 d = function() { 113 function a(a) { 114 return !1 === e ? !1 : "" === e ? a : e + a.charAt(0).toUpperCase() + a.substr(1) 115 } 116 var b = {}, 117 c = q.createElement("div").style, 118 e = function() { 119 for (var a = ["t", "webkitT", "MozT", "msT", "OT"], b, e = 0, d = a.length; e < d; e++) 120 if (b = a[e] + "ransform", b in c) return a[e].substr(0, a[e].length - 1); 121 return !1 122 }(); 123 b.getTime = Date.now || function() { 124 return (new Date).getTime() 125 }; 126 b.extend = function(a, b) { 127 for (var c in b) a[c] = 128 b[c] 129 }; 130 b.addEvent = function(a, b, c, e) { 131 a.addEventListener(b, c, !!e) 132 }; 133 b.removeEvent = function(a, b, c, e) { 134 a.removeEventListener(b, c, !!e) 135 }; 136 b.prefixPointerEvent = function(a) { 137 return g.MSPointerEvent ? "MSPointer" + a.charAt(7).toUpperCase() + a.substr(8) : a 138 }; 139 b.momentum = function(a, b, c, e, d, k) { 140 b = a - b; 141 c = f.abs(b) / c; 142 var g; 143 k = void 0 === k ? 6E-4 : k;
144 g = a + c * c / (2 * k) * (0 > b ? -1 : 1); 145 k = c / k; 146 g < e ? (g = d ? e - d / 2.5 * (c / 8) : e, b = f.abs(g - a), k = b / c) : 0 < g && (g = d ? d / 2.5 * (c / 8) : 0, b = f.abs(a) + g, k = b / c); 147 return { 148 destination: f.round(g), 149 duration: k 150 } 151 }; 152 var d = a("transform"); 153 b.extend(b, { 154 hasTransform: !1 !== d, 155 hasPerspective: a("perspective") in c, 156 hasTouch: "ontouchstart" in g, 157 hasPointer: !(!g.PointerEvent && !g.MSPointerEvent), 158 hasTransition: a("transition") in c 159 }); 160 b.isBadAndroid = function() { 161 var a = g.navigator.appVersion; 162 return /Android/.test(a) && !/Chrome\/\d/.test(a) ? (a = a.match(/Safari\/(\d+.\d)/)) && "object" === typeof a && 2 <= a.length ? 535.19 > parseFloat(a[1]) : !0 : !1 163 }(); 164 b.extend(b.style = {}, { 165 transform: d, 166 transitionTimingFunction: a("transitionTimingFunction"), 167 transitionDuration: a("transitionDuration"), 168 transitionDelay: a("transitionDelay"), 169 transformOrigin: a("transformOrigin") 170 }); 171 b.hasClass = function(a, b) { 172 return (new RegExp("(^|\\s)" + b + "(\\s|$)")).test(a.className) 173 }; 174 b.addClass = function(a, c) { 175 if (!b.hasClass(a, c)) { 176 var e = a.className.split(" "); 177 e.push(c); 178 a.className = e.join(" ") 179 } 180 }; 181 b.removeClass = function(a, c) { 182 b.hasClass(a, c) && (a.className = a.className.replace(new RegExp("(^|\\s)" + c + "(\\s|$)", "g"), " ")) 183 }; 184 b.offset = function(a) { 185 for (var b = -a.offsetLeft, c = -a.offsetTop; a = a.offsetParent;) b -= a.offsetLeft, c -= a.offsetTop; 186 return { 187 left: b, 188 top: c 189 } 190 }; 191 b.preventDefaultException = function(a, b) { 192 for (var c in b) 193 if (b[c].test(a[c])) return !0; 194 return !1 195 }; 196 b.extend(b.eventType = {}, { 197 touchstart: 1, 198 touchmove: 1, 199 touchend: 1, 200 mousedown: 2, 201 mousemove: 2, 202 mouseup: 2, 203 pointerdown: 3, 204 pointermove: 3, 205 pointerup: 3, 206 MSPointerDown: 3, 207 MSPointerMove: 3, 208 MSPointerUp: 3 209 }); 210 b.extend(b.ease = {}, { 211 quadratic: { 212 style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)", 213 fn: function(a) { 214 return a * (2 - a) 215 } 216 }, 217 circular: { 218 style: "cubic-bezier(0.1, 0.57, 0.1, 1)", 219 fn: function(a) { 220 return f.sqrt(1 - --a * a) 221 } 222 }, 223 back: { 224 style: "cubic-bezier(0.175, 0.885, 0.32, 1.275)", 225 fn: function(a) { 226 return --a * a * (5 * a + 4) + 1 227 } 228 }, 229 bounce: { 230 style: "", 231 fn: function(a) { 232 return (a /= 1) < 1 / 2.75 ? 7.5625 * a * a : a < 2 / 2.75 ? 7.5625 * (a -= 1.5 / 2.75) * a + .75 : a < 2.5 / 2.75 ? 7.5625 * (a -= 2.25 / 2.75) * a + .9375 : 7.5625 * (a -= 2.625 / 2.75) * a + .984375 233 } 234 }, 235 elastic: { 236 style: "", 237 fn: function(a) { 238 return 0 === a ? 0 : 1 == a ? 1 : .4 * f.pow(2, -10 * a) * f.sin(2 * (a - .055) * f.PI / .22) + 1 239 } 240 } 241 }); 242 b.tap = function(a, b) { 243 var c = q.createEvent("Event"); 244 c.initEvent(b, !0, !0); 245 c.pageX = a.pageX; 246 c.pageY = a.pageY; 247 a.target.dispatchEvent(c) 248 }; 249 b.click = function(a) { 250 var b = a.target, 251 c; 252 253 // nectar addition. 254 var activateEvent = false; 255 if( (/(INPUT)/i).test(b.tagName) ) { 256 257 if( b.getAttribute("type") == 'submit' || b.getAttribute("type") == 'button' ) { 258 activateEvent = true; 259 } 260 261 } 262 263 if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(b.tagName) || activateEvent ) { 264 (c = q.createEvent(g.MouseEvent ? "MouseEvents" : "Event"), 265 c.initEvent("click", !0, !0), c.view = a.view || g, c.detail = 1, c.screenX = b.screenX || 0, c.screenY = b.screenY || 0, c.clientX = b.clientX || 0, c.clientY = b.clientY || 0, c.ctrlKey = !!a.ctrlKey, c.altKey = !!a.altKey, c.shift
265Key = !!a.shiftKey, c.metaKey = !!a.metaKey, c.button = 0, c.relatedTarget = null, c._constructed = !0, b.dispatchEvent(c)) 266 } 267 268 }; 269 return b 270 }(); 271 p.prototype = { 272 version: "5.2.0", 273 _init: function() { 274 this._initEvents(); 275 (this.options.scrollbars || this.options.indicators) && this._initIndicators(); 276 this.options.mouseWheel && this._initWheel(); 277 this.options.snap && this._initSnap(); 278 this.options.keyBindings && this._initKeys() 279 }, 280 destroy: function() { 281 this._initEvents(!0); 282 clearTimeout(this.resizeTimeout); 283 this.resizeTimeout = null; 284 this._execEvent("destroy") 285 }, 286 _transitionEnd: function(a) { 287 a.target == this.scroller && this.isInTransition && (this._transitionTime(), this.resetPosition(this.options.bounceTime) || (this.isInTransition = !1, this._execEvent("scrollEnd"))) 288 }, 289 _start: function(a) { 290 if (!(1 != d.eventType[a.type] && 0 !== (a.which ? 291 a.button : 2 > a.button ? 0 : 4 == a.button ? 1 : 2) || !this.enabled || this.initiated && d.eventType[a.type] !== this.initiated)) { 292 !this.options.preventDefault || d.isBadAndroid || d.preventDefaultException(a.target, this.options.preventDefaultException) || a.preventDefault(); 293 var b = a.touches ? a.touches[0] : a; 294 this.initiated = d.eventType[a.type]; 295 this.moved = !1; 296 this.directionLocked = this.directionY = this.directionX = this.distY = this.distX = 0; 297 this.startTime = d.getTime(); 298 this.options.useTransition && this.isInTransition ? (this._transitionTime(), 299 this.isInTransition = !1, a = this.getComputedPosition(), this._translate(f.round(a.x), f.round(a.y)), this._execEvent("scrollEnd")) : !this.options.useTransition && this.isAnimating && (this.isAnimating = !1, this._execEvent("scrollEnd")); 300 this.startX = this.x; 301 this.startY = this.y; 302 this.absStartX = this.x; 303 this.absStartY = this.y; 304 this.pointX = b.pageX; 305 this.pointY = b.pageY; 306 this._execEvent("beforeScrollStart") 307 } 308 }, 309 _move: function(a) { 310 if (this.enabled && d.eventType[a.type] === this.initiated) { 311 this.options.preventDefault && a.preventDefault(); 312 var b = a.touches ? a.touches[0] : a, 313 c = b.pageX - this.pointX, 314 e = b.pageY - this.pointY, 315 k = d.getTime(), 316 h; 317 this.pointX = b.pageX; 318 this.pointY = b.pageY; 319 this.distX += c; 320 this.distY += e; 321 b = f.abs(this.distX); 322 h = f.abs(this.distY); 323 if (!(300 < k - this.endTime && 10 > b && 10 > h)) { 324 this.directionLocked || this.options.freeScroll || (this.directionLocked = b > h + this.options.directionLockThreshold ? "h" : h >= b + this.options.directionLockThreshold ? "v" : "n"); 325 if ("h" == this.directionLocked) { 326 if ("vertical" == this.options.eventPassthrough) a.preventDefault(); 327 else if ("horizontal" == 328 this.options.eventPassthrough) { 329 this.initiated = !1; 330 return 331 } 332 e = 0 333 } else if ("v" == this.directionLocked) { 334 if ("horizontal" == this.options.eventPassthrough) a.preventDefault(); 335 else if ("vertical" == this.options.eventPassthrough) { 336 this.initiated = !1; 337 return 338 } 339 c = 0 340 } 341 c = this.hasHorizontalScroll ? c : 0; 342 e = this.hasVerticalScroll ? e : 0; 343 a = this.x + c; 344 b = this.y + e; 345 if (0 < a || a < this.maxScrollX) a = this.options.bounce ? this.x + c / 3 : 0 < a ? 0 : this.maxScrollX; 346 if (0 < b || b < this.maxScrollY) b = this.options.bounce ? this.y + e / 3 : 0 < b ? 0 : this.maxScrollY; 347 this.directionX = 348 0 < c ? -1 : 0 > c ? 1 : 0; 349 this.directionY = 0 < e ? -1 : 0 > e ? 1 : 0; 350 this.moved || this._execEvent("scrollStart"); 351 this.moved = !0; 352 this._translate(a, b); 353 300 < k - this.startTime && (this.startTime = k, this.startX = this.x, this.startY = this.y) 354 } 355 } 356 }, 357 _end: function(a) { 358 if (this.enabled && d.eventType[a.type] === this.initiated) { 359 this.options.preventDefault && !d.preventDefaultException(a.target, this.options.preventDefaultException) && a.preventDefault(); 360 var b, c; 361 c = d.getTime() - this.startTime; 362 var e = f.round(this.x), 363 k = f.round(this.y), 364 h = f.abs(e - this.startX), 365 g = f.abs(k - this.startY); 366 b = 0; 367 var l = ""; 368 this.initiated = this.isInTransition = 0; 369 this.endTime = d.getTime(); 370 if (!this.resetPosition(this.options.bounceTime)) 371 if (this.scrollTo(e, k), this.moved) 372 if (this._events.flick && 200 > c && 100 > h && 100 > g) this._execEvent("flick"); 373 else if (this.options.momentum && 300 > c && (b = this.hasHorizontalScroll ? d.momentum(this.x, this.startX, c, this.maxScrollX, this.options.bounce ? this.wrapperW
373idth : 0, this.options.deceleration) : { 374 destination: e, 375 duration: 0 376 }, c = this.hasVerticalScroll ? d.momentum(this.y, this.startY, 377 c, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { 378 destination: k, 379 duration: 0 380 }, e = b.destination, k = c.destination, b = f.max(b.duration, c.duration), this.isInTransition = 1), this.options.snap && (this.currentPage = l = this._nearestSnap(e, k), b = this.options.snapSpeed || f.max(f.max(f.min(f.abs(e - l.x), 1E3), f.min(f.abs(k - l.y), 1E3)), 300), e = l.x, k = l.y, this.directionY = this.directionX = 0, l = this.options.bounceEasing), e != this.x || k != this.y) { 381 if (0 < e || e < this.maxScrollX || 0 < k || k < this.maxScrollY) l = 382 d.ease.quadratic; 383 this.scrollTo(e, k, b, l) 384 } else this._execEvent("scrollEnd"); 385 else this.options.tap && d.tap(a, this.options.tap), this.options.click && d.click(a), this._execEvent("scrollCancel") 386 } 387 }, 388 _resize: function() { 389 var a = this; 390 clearTimeout(this.resizeTimeout); 391 this.resizeTimeout = setTimeout(function() { 392 a.refresh() 393 }, this.options.resizePolling) 394 }, 395 resetPosition: function(a) { 396 var b = this.x, 397 c = this.y; 398 !this.hasHorizontalScroll || 0 < this.x ? b = 0 : this.x < this.maxScrollX && (b = this.maxScrollX); 399 !this.hasVerticalScroll || 0 < this.y ? c = 400 0 : this.y < this.maxScrollY && (c = this.maxScrollY); 401 if (b == this.x && c == this.y) return !1; 402 this.scrollTo(b, c, a || 0, this.options.bounceEasing); 403 return !0 404 }, 405 disable: function() { 406 this.enabled = !1 407 }, 408 enable: function() { 409 this.enabled = !0 410 }, 411 refresh: function() { 412 this.wrapperWidth = this.wrapper.clientWidth; 413 this.wrapperHeight = this.wrapper.clientHeight; 414 this.scrollerWidth = this.scroller.offsetWidth; 415 this.scrollerHeight = this.scroller.offsetHeight; 416 this.maxScrollX = this.wrapperWidth - this.scrollerWidth; 417 this.maxScrollY = this.wrapperHeight - this.scrollerHeight; 418 this.hasHorizontalScroll = this.options.scrollX && 0 > this.maxScrollX; 419 this.hasVerticalScroll = this.options.scrollY && 0 > this.maxScrollY; 420 this.hasHorizontalScroll || (this.maxScrollX = 0, this.scrollerWidth = this.wrapperWidth); 421 this.hasVerticalScroll || (this.maxScrollY = 0, this.scrollerHeight = this.wrapperHeight); 422 this.directionY = this.directionX = this.endTime = 0; 423 this.wrapperOffset = d.offset(this.wrapper); 424 this._execEvent("refresh"); 425 this.resetPosition() 426 }, 427 on: function(a, b) { 428 this._events[a] || (this._events[a] = []); 429 this._events[a].push(b) 430 }, 431 off: function(a, b) { 432 if (this._events[a]) { 433 var c = this._events[a].indexOf(b); - 1 < c && this._events[a].splice(c, 1) 434 } 435 }, 436 _execEvent: function(a) { 437 if (this._events[a]) { 438 var b = 0, 439 c = this._events[a].length; 440 if (c) 441 for (; b < c; b++) this._events[a][b].apply(this, [].slice.call(arguments, 1)) 442 } 443 }, 444 scrollBy: function(a, b, c, e) { 445 a = this.x + a; 446 b = this.y + b; 447 this.scrollTo(a, b, c || 0, e) 448 }, 449 scrollTo: function(a, b, c, e) { 450 e = e || d.ease.circular; 451 this.isInTransition = this.options.useTransition && 0 < c; 452 var f = this.options.useTransition && e.style; 453 !c || f ? (f && (this._transitionTimingFunction(e.style), 454 this._transitionTime(c)), this._translate(a, b)) : this._animate(a, b, c, e.fn) 455 }, 456 scrollToElement: function(a, b, c, e, k) { 457 if (a = a.nodeType ? a : this.scroller.querySelector(a)) { 458 var h = d.offset(a); 459 h.left -= this.wrapperOffset.left; 460 h.top -= this.wrapperOffset.top; 461 !0 === c && (c = f.round(a.offsetWidth / 2 - this.wrapper.offsetWidth / 2)); 462 !0 === e && (e = f.round(a.offsetHeight / 2 - this.wrapper.offsetHeight / 2)); 463 h.left -= c || 0; 464 h.top -= e || 0; 465 h.left = 0 < h.left ? 0 : h.left < this.maxScrollX ? this.maxScrollX : h.left; 466 h.top = 0 < h.top ? 0 : h.top < this.maxScrollY ? this.maxScrollY : 467 h.top; 468 b = void 0 === b || null === b || "auto" === b ? f.max(f.abs(this.x - h.left), f.abs(this.y - h.top)) : b; 469 this.scrollTo(h.left, h.top, b, k) 470 } 471 }, 472 _transitionTime: function(a) { 473 if (this.options.useTransition) { 474 a = a || 0; 475 var b = d.style.transitionDuration; 476 if (b) { 477 this.scrollerStyle[b] = a + "ms"; 478 if (!a && d.isBadAndroid) { 479 this.scrollerStyle[b] = "0.0001ms"; 480 var c = this; 481 t(function() { 482 "0.0001ms" === c.scrollerStyle[b] && (c.scrollerStyle[b] = "0s") 483 }) 484 } 485 if (this.indicators) 486 for (var e = this.indicators.length; e--;) this.indicators[e].transitionTime(a) 487 } 488 } 489 }, 490 _transitionTimingFunction: function(a) { 491 this.scrollerStyle[d.style.transitionTimingFunction] = 492 a; 493 if (this.indicators) 494 for (var b = this.indicators.length; b--;) this.indicators[b].transitionTimingFunction(a) 495 }, 496 _translate: function(a, b) { 497 this.options.useTransform ? this.scrollerStyle[d.style.transform] = "translate(" + a + "px," + b + "px)" + this.translateZ : (a = f.round(a), b = f.round(b), this.scrollerStyle.left = a + "px", this.scrollerStyle.top = b + "px"); 498 this.x = a; 499 this.y = b; 500 if (this.indicators) 501 for (var c = this.indicators.length; c--;) this.indicators[c].updatePosition() 502 }, 503 _initEvents: function(a) { 504 a = a ? d.removeEvent : d.addEvent; 505 var b = 506 this.options.bindToWrapper ? this.wrapper : g; 507 a(g, "orientationchange", this); 508 a(g, "resize", this); 509 this.options.click && a(this.wrapper, "click", this, !0); 510 this.options.disableMouse || (a(this.wrapper, "mousedown", this), a(b, "mousemove", this), a(b, "mousecancel", this), a(b, "mouseup", this)); 511 d.hasPointer && !this.options.disablePointer && (a(this.wrapper, d.prefixPointerEvent("pointerdown"), this), a(b, d.prefixPointerEvent("pointermove"), this), a(b, d.prefixPointerEvent("pointercancel"), this), a(b, d.prefixPointerEvent("pointerup"), 512 this)); 513 d.hasTouch && !this.options.disableTouch && (a(this.wrapper, "touchstart", this), a(b, "touchmove", this), a(b, "touchcancel", this), a(b, "touchend", this)); 514 a(this.scroller, "transitionend", this); 515 a(this.scroller, "webkitTransitionEnd", this); 516 a(this.scroller, "oTransitionEnd", this); 517 a(this.scroller, "MSTransitionEnd", this) 518 }, 519 getComputedPosition: function() { 520 var a = g.getComputedStyle(this.scroller, null), 521 b; 522 this.options.useTransform ? (a = a[d.style.transform].split(")")[0].split(", "), b = +(a[12] || a[4]), a = +(a[13] || a[5])) : 523 (b = +a.left.replace(/[^-\d.]/g, ""), a = +a.top.replace(/[^-\d.]/g, "")); 524 return { 525 x: b, 526 y: a 527 } 528 }, 529 _initIndicators: function() { 530 function a(a) { 531 if (f.indicators) 532 for (var b = f.indicators.length; b--;) a.call(f.indicators[b]) 533 } 534 var b = this.options.interactiveScrollbars, 535 c = "string" != typeof this.options.scrollbars, 536 e = [], 537 d, f = this; 538 this.indicators = []; 539 this.options.scrollbars && (this.options.scrollY && (d = { 540 el: u("v", b, this.options.scrollbars), 541 interactive: b, 542 defaultScrollbars: !0, 543 customStyle: c, 544 resize: this.options.resizeScrollbars, 545 shrink: this.options.shrinkScrollbars, 546 fade: this.options.fadeScrollbars, 547 listenX: !1 548 }, this.wrapper.appendChild(d.el), e.push(d)), this.options.scrollX && (d = { 549 el: u("h", b, this.options.scrollbars), 550 interactive: b, 551 defaultScrollbars: !0, 552 customStyle: c, 553 resize: this.options.resizeScrollbars, 554 shrink: this.options.shrinkScrollbars, 555 fade: this.options.fadeScrollbars, 556 listenY: !1 557 }, this.wrapper.appendChild(d.el), e.push(d))); 558 this.options.indicators && (e = e.concat(this.options.indicators)); 559 for (b = e.length; b--;) this.indicators.push(new v(this, e[b])); 560 this.options.fadeScrollbars && 561 (this.on("scrollEnd", function() { 562 a(function() { 563 this.fade() 564 }) 565 }), this.on("scrollCancel", function() { 566 a(function() { 567 this.fade() 568 }) 569 }), this.on("scrollStart", function() { 570 a(function() { 571 this.fade(1) 572 }) 573 }), this.on("beforeScrollStart", function() { 574 a(function() { 575 this.fade(1, !0) 576 }) 577 })); 578 this.on("refresh", function() { 579 a(function() { 580 this.refresh() 581 }) 582 }); 583 this.on("destroy", function() { 584 a(function() { 585 this.destroy() 586 }); 587 delete this.indicators 588 }) 589 }, 590 _initWheel: function() { 591 d.addEvent(this.wrapper, "wheel", this); 592 d.addEvent(this.wrapper, "mousewheel", 593 this); 594 d.addEvent(this.wrapper, "DOMMouseScroll", this); 595 this.on("destroy", function() { 596 clearTimeout(this.wheelTimeout); 597 this.wheelTimeout = null; 598 d.removeEvent(this.wrapper, "wheel", this); 599 d.removeEvent(this.wrapper, "mousewheel", this); 600 d.removeEvent(this.wrapper, "DOMMouseScroll", this) 601 }) 602 }, 603 _wheel: function(a) { 604 if (this.enabled) { 605 var b, c, e, d = this; 606 void 0 === this.wheelTimeout && d._execEvent("scrollStart"); 607 clearTimeout(this.wheelTimeout); 608 this.wheelTimeout = setTimeout(function() { 609 d.options.snap || d._execEvent("scrollEnd"); 610 d.wheelTimeout = 611 void 0 612 }, 400); 613 if ("deltaX" in a) 1 === a.deltaMode ? (b = -a.deltaX * this.options.mouseWheelSpeed, a = -a.deltaY * this.options.mouseWheelSpeed) : (b = -a.deltaX, a = -a.deltaY); 614 else if ("wheelDeltaX" in a) b = a.wheelDeltaX / 120 * this.options.mouseWheelSpeed, a = a.wheelDeltaY / 120 * this.options.mouseWheelSpeed; 615 else if ("wheelDelta" in a) b = a = a.wheelDelta / 120 * this.options.mouseWheelSpeed; 616 else if ("detail" in a) b = a = -a.detail / 3 * this.options.mouseWheelSpeed; 617 else return; 618 b *= this.options.invertWheelDirection; 619 a *= this.options.invertWheelDirection; 620 this.hasVerticalScroll || (b = a, a = 0); 621 this.options.snap ? (c = this.currentPage.pageX, e = this.currentPage.pageY, 0 < b ? c-- : 0 > b && c++, 0 < a ? e-- : 0 > a && e++, this.goToPage(c, e)) : (c = this.x + f.round(this.hasHorizontalScroll ? b : 0), e = this.y + f.round(this.hasVerticalScroll ? a : 0), this.directionX = 0 < b ? -1 : 0 > b ? 1 : 0, this.directionY = 0 < a ? -1 : 0 > a ? 1 : 0, 0 < c ? c = 0 : c < this.maxScrollX && (c = this.maxScrollX), 0 < e ? e = 0 : e < this.maxScrollY && (e = this.maxScrollY), this.scrollTo(c, e, 0)) 622 } 623 }, 624 _initSnap: function() { 625 this.currentPage = {}; 626 "string" == typeof this.options.snap && 627 (this.options.snap = this.scroller.querySelectorAll(this.options.snap)); 628 this.on("refresh", function() { 629 var a = 0, 630 b, c = 0, 631 e, d, g, n = 0, 632 l;
633 e = this.options.snapStepX || this.wrapperWidth; 634 var m = this.options.snapStepY || this.wrapperHeight; 635 this.pages = []; 636 if (this.wrapperWidth && this.wrapperHeight && this.scrollerWidth && this.scrollerHeight) { 637 if (!0 === this.options.snap) 638 for (d = f.round(e / 2), g = f.round(m / 2); n > -this.scrollerWidth;) { 639 this.pages[a] = []; 640 for (l = b = 0; l > -this.scrollerHeight;) this.pages[a][b] = { 641 x: f.max(n, this.maxScrollX), 642 y: f.max(l, 643 this.maxScrollY), 644 width: e, 645 height: m, 646 cx: n - d, 647 cy: l - g 648 }, l -= m, b++; 649 n -= e; 650 a++ 651 } else 652 for (m = this.options.snap, b = m.length, e = -1; a < b; a++) { 653 if (0 === a || m[a].offsetLeft <= m[a - 1].offsetLeft) c = 0, e++; 654 this.pages[c] || (this.pages[c] = []); 655 n = f.max(-m[a].offsetLeft, this.maxScrollX); 656 l = f.max(-m[a].offsetTop, this.maxScrollY); 657 d = n - f.round(m[a].offsetWidth / 2); 658 g = l - f.round(m[a].offsetHeight / 2); 659 this.pages[c][e] = { 660 x: n, 661 y: l, 662 width: m[a].offsetWidth, 663 height: m[a].offsetHeight, 664 cx: d, 665 cy: g 666 }; 667 n > this.maxScrollX && c++ 668 } 669 this.goToPage(this.currentPage.pageX || 670 0, this.currentPage.pageY || 0, 0); 671 0 === this.options.snapThreshold % 1 ? this.snapThresholdY = this.snapThresholdX = this.options.snapThreshold : (this.snapThresholdX = f.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold), this.snapThresholdY = f.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold)) 672 } 673 }); 674 this.on("flick", function() { 675 var a = this.options.snapSpeed || f.max(f.max(f.min(f.abs(this.x - this.startX), 1E3), f.min(f.abs(this.y - 676 this.startY), 1E3)), 300); 677 this.goToPage(this.currentPage.pageX + this.directionX, this.currentPage.pageY + this.directionY, a) 678 }) 679 }, 680 _nearestSnap: function(a, b) { 681 if (!this.pages.length) return { 682 x: 0, 683 y: 0, 684 pageX: 0, 685 pageY: 0 686 }; 687 var c = 0, 688 e = this.pages.length, 689 d = 0; 690 if (f.abs(a - this.absStartX) < this.snapThresholdX && f.abs(b - this.absStartY) < this.snapThresholdY) return this.currentPage; 691 0 < a ? a = 0 : a < this.maxScrollX && (a = this.maxScrollX); 692 0 < b ? b = 0 : b < this.maxScrollY && (b = this.maxScrollY); 693 for (; c < e; c++) 694 if (a >= this.pages[c][0].cx) { 695 a = this.pages[c][0].x; 696 break 697 } for (e = this.pages[c].length; d < e; d++) 698 if (b >= this.pages[0][d].cy) { 699 b = this.pages[0][d].y; 700 break 701 } c == this.currentPage.pageX && (c += this.directionX, 0 > c ? c = 0 : c >= this.pages.length && (c = this.pages.length - 1), a = this.pages[c][0].x); 702 d == this.currentPage.pageY && (d += this.directionY, 0 > d ? d = 0 : d >= this.pages[0].length && (d = this.pages[0].length - 1), b = this.pages[0][d].y); 703 return { 704 x: a, 705 y: b, 706 pageX: c, 707 pageY: d 708 } 709 }, 710 goToPage: function(a, b, c, d) { 711 d = d || this.options.bounceEasing; 712 a >= this.pages.length ? a = this.pages.length - 1 : 0 > a && (a = 0); 713 b >= this.pages[a].length ? 714 b = this.pages[a].length - 1 : 0 > b && (b = 0); 715 var g = this.pages[a][b].x, 716 h = this.pages[a][b].y; 717 c = void 0 === c ? this.options.snapSpeed || f.max(f.max(f.min(f.abs(g - this.x), 1E3), f.min(f.abs(h - this.y), 1E3)), 300) : c; 718 this.currentPage = { 719 x: g, 720 y: h, 721 pageX: a, 722 pageY: b 723 }; 724 this.scrollTo(g, h, c, d) 725 }, 726 next: function(a, b) { 727 var c = this.currentPage.pageX, 728 d = this.currentPage.pageY; 729 c++; 730 c >= this.pages.length && this.hasVerticalScroll && (c = 0, d++); 731 this.goToPage(c, d, a, b) 732 }, 733 prev: function(a, b) { 734 var c = this.currentPage.pageX, 735 d = this.currentPage.pageY; 736 c--; 737 0 > c && this.hasVerticalScroll && 738 (c = 0, d--); 739 this.goToPage(c, d, a, b) 740 }, 741 _initKeys: function(a) { 742 a = { 743 pageUp: 33, 744 pageDown: 34, 745 end: 35, 746 home: 36, 747 left: 37, 748 up: 38, 749 right: 39, 750 down: 40 751 }; 752 var b; 753 if ("object" == typeof this.options.keyBindings) 754 for (b in this.options.keyBindings) "string" == typeof this.options.keyBindings[b] && (this.options.keyBindings[b] = this.options.keyBindings[b].toUpperCase().charCo
754deAt(0)); 755 else this.options.keyBindings = {}; 756 for (b in a) this.options.keyBindings[b] = this.options.keyBindings[b] || a[b]; 757 d.addEvent(g, "keydown", this); 758 this.on("destroy", function() { 759 d.removeEvent(g, 760 "keydown", this) 761 }) 762 }, 763 _key: function(a) { 764 if (this.enabled) { 765 var b = this.options.snap, 766 c = b ? this.currentPage.pageX : this.x, 767 e = b ? this.currentPage.pageY : this.y, 768 g = d.getTime(), 769 h = this.keyTime || 0, 770 n; 771 this.options.useTransition && this.isInTransition && (n = this.getComputedPosition(), this._translate(f.round(n.x), f.round(n.y)), this.isInTransition = !1); 772 this.keyAcceleration = 200 > g - h ? f.min(this.keyAcceleration + .25, 50) : 0; 773 switch (a.keyCode) { 774 case this.options.keyBindings.pageUp: 775 this.hasHorizontalScroll && !this.hasVerticalScroll ? c += b ? 776 1 : this.wrapperWidth : e += b ? 1 : this.wrapperHeight; 777 break; 778 case this.options.keyBindings.pageDown: 779 this.hasHorizontalScroll && !this.hasVerticalScroll ? c -= b ? 1 : this.wrapperWidth : e -= b ? 1 : this.wrapperHeight; 780 break; 781 case this.options.keyBindings.end: 782 c = b ? this.pages.length - 1 : this.maxScrollX; 783 e = b ? this.pages[0].length - 1 : this.maxScrollY; 784 break; 785 case this.options.keyBindings.home: 786 e = c = 0; 787 break; 788 case this.options.keyBindings.left: 789 c += b ? -1 : 5 + this.keyAcceleration >> 0; 790 break; 791 case this.options.keyBindings.up: 792 e += b ? 1 : 5 + this.keyAcceleration >> 793 0; 794 break; 795 case this.options.keyBindings.right: 796 c -= b ? -1 : 5 + this.keyAcceleration >> 0; 797 break; 798 case this.options.keyBindings.down: 799 e -= b ? 1 : 5 + this.keyAcceleration >> 0; 800 break; 801 default: 802 return 803 } 804 b ? this.goToPage(c, e) : (0 < c ? this.keyAcceleration = c = 0 : c < this.maxScrollX && (c = this.maxScrollX, this.keyAcceleration = 0), 0 < e ? this.keyAcceleration = e = 0 : e < this.maxScrollY && (e = this.maxScrollY, this.keyAcceleration = 0), this.scrollTo(c, e, 0), this.keyTime = g) 805 } 806 }, 807 _animate: function(a, b, c, e) { 808 function f() { 809 var r = d.getTime(), 810 p; 811 r >= q ? (g.isAnimating = !1, g._translate(a, 812 b), g.resetPosition(g.options.bounceTime) || g._execEvent("scrollEnd")) : (r = (r - m) / c, p = e(r), r = (a - n) * p + n, p = (b - l) * p + l, g._translate(r, p), g.isAnimating && t(f)) 813 } 814 var g = this, 815 n = this.x, 816 l = this.y, 817 m = d.getTime(), 818 q = m + c; 819 this.isAnimating = !0; 820 f() 821 }, 822 handleEvent: function(a) { 823 switch (a.type) { 824 case "touchstart": 825 case "pointerdown": 826 case "MSPointerDown": 827 case "mousedown": 828 this._start(a); 829 break; 830 case "touchmove": 831 case "pointermove": 832 case "MSPointerMove": 833 case "mousemove": 834 this._move(a); 835 break; 836 case "touchend": 837 case "pointerup": 838 case "MSPointerUp": 839 case "mouseup": 840 case "touchcancel": 841 case "pointercancel": 842 case "MSPointerCancel": 843 case "mousecancel": 844 this._end(a); 845 break; 846 case "orientationchange": 847 case "resize": 848 this._resize(); 849 break; 850 case "transitionend": 851 case "webkitTransitionEnd": 852 case "oTransitionEnd": 853 case "MSTransitionEnd": 854 this._transitionEnd(a); 855 break; 856 case "wheel": 857 case "DOMMouseScroll": 858 case "mousewheel": 859 this._wheel(a); 860 break; 861 case "keydown": 862 this._key(a); 863 break; 864 case "click": 865 this.enabled && !a._constructed && (a.preventDefault(), a.stopPropagation()) 866 } 867 } 868 }; 869 v.prototype = { 870 handleEvent: function(a) { 871 switch (a.type) { 872 case "touchstart": 873 case "pointerdown": 874 case "MSPointerDown": 875 case "mousedown": 876 this._start(a); 877 break; 878 case "touchmove": 879 case "pointermove": 880 case "MSPointerMove": 881 case "mousemove": 882 this._move(a); 883 break; 884 case "touchend": 885 case "pointerup": 886 case "MSPointerUp": 887 case "mouseup": 888 case "touchcancel": 889 case "pointercancel": 890 case "MSPointerCancel": 891 case "mousecancel": 892 this._end(a) 893 } 894 }, 895 destroy: function() { 896 this.options.fadeScrollbars && (clearTimeout(this.fadeTimeout), this.fadeTimeout = null); 897 this.options.interactive && (d.removeEvent(this.indicator, "touchstart", this), d.removeEvent(this.indicator, d.prefixPointerEvent("pointerdown"), 898 this), d.removeEvent(this.indicator, "mousedown", this), d.removeEvent(g, "touchmove", this), d.removeEvent(g, d.prefixPointerEvent("pointermove"), this), d.removeEvent(g, "mousemove", this), d.removeEvent(g, "touchend", this), d.removeEvent(g, d.prefixPointerEvent("pointerup"), this), d.removeEvent(g, "mouseup", this)); 899 this.options.defaultScrollbars && this.wrapper.parentNode.removeChild(this.wrapper) 900 }, 901 _start: function(a) { 902 var b = a.touches ? a.touches[0] : a; 903 a.preventDefault(); 904 a.stopPropagation(); 905 this.transitionTime(); 906 this.initiated = !0; 907 this.moved = !1; 908 this.lastPointX = b.pageX; 909 this.lastPointY = b.pageY; 910 this.startTime = d.getTime(); 911 this.options.disableTouch || d.addEvent(g, "touchmove", this); 912 this.options.disablePointer || d.addEvent(g, d.prefixPointerEvent("pointermove"), this); 913 this.options.disableMouse || d.addEvent(g, "mousemove", this); 914 this.scroller._execEvent("beforeScrollStart") 915 }, 916 _move: function(a) { 917 var b = a.touches ? a.touches[0] : a, 918 c, e; 919 d.getTime(); 920 this.moved || this.scroller._execEvent("scrollStart"); 921 this.moved = !0; 922 c = b.pageX - this.lastPointX; 923 this.lastPointX = 924 b.pageX; 925 e = b.pageY - this.lastPointY; 926 this.lastPointY = b.pageY; 927 this._pos(this.x + c, this.y + e); 928 a.preventDefault(); 929 a.stopPropagation() 930 }, 931 _end: function(a) { 932 if (this.initiated) { 933 this.initiated = !1; 934 a.preventDefault(); 935 a.stopPropagation(); 936 d.removeEvent(g, "touchmove", this); 937 d.removeEvent(g, d.prefixPointerEvent("pointermove"), this); 938 d.removeEvent(g, "mousemove", this); 939 if (this.scroller.options.snap) { 940 a = this.scroller._nearestSnap(this.scroller.x, this.scroller.y); 941 var b = this.options.snapSpeed || f.max(f.max(f.min(f.abs(this.scroller.x - 942 a.x), 1E3), f.min(f.abs(this.scroller.y - a.y), 1E3)), 300); 943 if (this.scroller.x != a.x || this.scroller.y != a.y) this.scroller.directionX = 0, this.scroller.directionY = 0, this.scroller.currentPage = a, this.scroller.scrollTo(a.x, a.y, b, this.scroller.options.bounceEasing) 944 } 945 this.moved && this.scroller._execEvent("scrollEnd") 946 } 947 }, 948 transitionTime: function(a) { 949 a = a || 0; 950 var b = d.style.transitionDuration; 951 if (b && (this.indicatorStyle[b] = a + "ms", !a && d.isBadAndroid)) { 952 this.indicatorStyle[b] = "0.0001ms"; 953 var c = this; 954 t(function() { 955 "0.0001ms" === c.indicatorStyle[b] && 956 (c.indicatorStyle[b] = "0s") 957 }) 958 } 959 }, 960 transitionTimingFunction: function(a) { 961 this.indicatorStyle[d.style.transitionTimingFunction] = a 962 }, 963 refresh: function() { 964 this.transitionTime(); 965 this.indicatorStyle.display = this.options.listenX && !this.options.listenY ? this.scroller.hasHorizontalScroll ? "block" : "none" : this.options.listenY && !this.options.listenX ? this.scroller.hasVerticalScroll ? "block" : "none" : this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? "block" : "none"; 966 this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ? 967 (d.addClass(this.wrapper, "iScrollBothScrollbars"), d.removeClass(this.wrapper, "iScrollLoneScrollbar"), this.options.defaultScrollbars && this.options.customStyle && (this.options.listenX ? this.wrapper.style.right = "8px" : this.wrapper.style.bottom = "8px")) : (d.removeClass(this.wrapper, "iScrollBothScrollbars"), d.addClass(this.wrapper, "iScrollLoneScrollbar"), this.options.defaultScrollbars && this.options.customStyle && (this.options.listenX ? this.wrapper.style.right = "2px" : this.wrapper.style.bottom = "2px")); 968 this.options.listenX &&
969 (this.wrapperWidth = this.wrapper.clientWidth, this.options.resize ? (this.indicatorWidth = f.max(f.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8), this.indicatorStyle.width = this.indicatorWidth + "px") : this.indicatorWidth = this.indicator.clientWidth, this.maxPosX = this.wrapperWidth - this.indicatorWidth, "clip" == this.options.shrink ? (this.minBoundaryX = -this.indicatorWidth + 8, this.maxBoundaryX = this.wrapperWidth - 8) : (this.minBoundaryX = 0, this.maxBoundaryX = this.maxPosX), 970 this.sizeRatioX = this.options.speedRatioX || this.scroller.maxScrollX && this.maxPosX / this.scroller.maxScrollX); 971 this.options.listenY && (this.wrapperHeight = this.wrapper.clientHeight, this.options.resize ? (this.indicatorHeight = f.max(f.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8), this.indicatorStyle.height = this.indicatorHeight + "px") : this.indicatorHeight = this.indicator.clientHeight, this.maxPosY = this.wrapperHeight - this.indicatorHeight, "clip" == this.options.shrink ? 972 (this.minBoundaryY = -this.indicatorHeight + 8, this.maxBoundaryY = this.wrapperHeight - 8) : (this.minBoundaryY = 0, this.maxBoundaryY = this.maxPosY), this.maxPosY = this.wrapperHeight - this.indicatorHeight, this.sizeRatioY = this.options.speedRatioY || this.scroller.maxScrollY && this.maxPosY / this.scroller.maxScrollY); 973 this.updatePosition() 974 }, 975 updatePosition: function() { 976 var a = this.options.listenX && f.round(this.sizeRatioX * this.scroller.x) || 0, 977 b = this.options.listenY && f.round(this.sizeRatioY * this.scroller.y) || 0; 978 this.options.ignoreBoundaries || 979 (a < this.minBoundaryX ? ("scale" == this.options.shrink && (this.width = f.max(this.indicatorWidth + a, 8), this.indicatorStyle.width = this.width + "px"), a = this.minBoundaryX) : a > this.maxBoundaryX ? "scale" == this.options.shrink ? (this.width = f.max(this.indicatorWidth - (a - this.maxPosX), 8), this.indicatorStyle.width = this.width + "px", a = this.maxPosX + this.indicatorWidth - this.width) : a = this.maxBoundaryX : "scale" == this.options.shrink && this.width != this.indicatorWidth && (this.width = this.indicatorWidth, this.indicatorStyle.width = this.width + 980 "px"), b < this.minBoundaryY ? ("scale" == this.options.shrink && (this.height = f.max(this.indicatorHeight + 3 * b, 8), this.indicatorStyle.height = this.height + "px"), b = this.minBoundaryY) : b > this.maxBoundaryY ? "scale" == this.options.shrink ? (this.height = f.max(this.indicatorHeight - 3 * (b - this.maxPosY), 8), this.indicatorStyle.height = this.height + "px", b = this.maxPosY + this.indicatorHeight - this.height) : b = this.maxBoundaryY : "scale" == this.options.shrink && this.height != this.indicatorHeight && (this.height = this.indicatorHeight, this.indicatorStyle.height = 981 this.height + "px")); 982 this.x = a; 983 this.y = b; 984 this.scroller.options.useTransform ? this.indicatorStyle[d.style.transform] = "translate(" + a + "px," + b + "px)" + this.scroller.translateZ : (this.indicatorStyle.left = a + "px", this.indicatorStyle.top = b + "px") 985 }, 986 _pos: function(a, b) { 987 0 > a ? a = 0 : a > this.maxPosX && (a = this.maxPosX); 988 0 > b ? b = 0 : b > this.maxPosY && (b = this.maxPosY); 989 a = this.options.listenX ? f.round(a / this.sizeRatioX) : this.scroller.x; 990 b = this.options.listenY ? f.round(b / this.sizeRatioY) : this.scroller.y; 991 this.scroller.scrollTo(a, b) 992 }, 993 fade: function(a, 994 b) { 995 if (!b || this.visible) { 996 clearTimeout(this.fadeTimeout); 997 this.fadeTimeout = null; 998 var c = a ? 0 : 300; 999 this.wrapperStyle[d.style.transitionDuration] = (a ? 250 : 500) + "ms"; 1000 this.fadeTimeout = setTimeout(function(a) { 1001 this.wrapperStyle.opacity = a; 1002 this.visible = +a 1003 }.bind(this, a ? "1" : "0"), c) 1004 } 1005 } 1006 }; 1007 p.utils = d; 1008 "undefined" != typeof module && module.exports ? module.exports = p : "function" == typeof define && define.amd ? define(function() { 1009 return p 1010 }) : g.IScroll = p 1011})(window, document, Math); 1012 1013 1014 1015 1016 1017 1018/*! 1019 * fullPage 2.8.1 1020 * https://github.com/alvarotrigo/fullPage.js 1021 * @license MIT licensed 1022 * 1023 * Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo 1024 */ 1025(function(global, factory) { 1026 'use strict'; 1027 if (typeof define === 'function' && define.amd) { 1028 define(['jquery'], function($) { 1029 return factory($, global, global.document, global.Math); 1030 }); 1031 } else if (typeof exports !== 'undefined') { 1032 module.exports = factory(require('jquery'), global, global.document, global.Math); 1033 } else { 1034 factory(jQuery, global, global.document, global.Math); 1035 } 1036})(typeof window !== 'undefined' ? window : this, function($, window, document, Math, undefined) { 1037 'use strict'; 1038 1039 // keeping central set of classnames and selectors 1040 var WRAPPER = 'fullpage-wrapper'; 1041 var WRAPPER_SEL = '.' + WRAPPER; 1042 1043 // slimscroll 1044 var SCROLLABLE = 'fp-scrollable'; 1045 var SCROLLABLE_SEL = '.' + SCROLLABLE; 1046 1047 // util 1048 var RESPONSIVE = 'fp-responsive'; 1049 var NO_TRANSITION = 'fp-notransition'; 1050 var DESTROYED = 'fp-destroyed'; 1051 var ENABLED = 'fp-enabled'; 1052 var VIEWING_PREFIX = 'fp-viewing'; 1053 var ACTIVE = 'active'; 1054 var ACTIVE_SEL = '.' + ACTIVE; 1055 var COMPLETELY = 'fp-completely'; 1056 var COMPLETELY_SEL = '.' + COMPLETELY; 1057 1058 // section 1059 var SECTION_DEFAULT_SEL = '.section'; 1060 var SECTION = 'fp-section'; 1061 var SECTION_SEL = '.' + SECTION; 1062 var SECTION_ACTIVE_SEL = SECTION_SEL + ACTIVE_SEL; 1063 var SECTION_FIRST_SEL = SECTION_SEL + ':first'; 1064 var SECTION_LAST_SEL = SECTION_SEL + ':last'; 1065 var TABLE_CELL = 'fp-tableCell'; 1066 var TABLE_CELL_SEL = '.' + TABLE_CELL; 1067 var AUTO_HEIGHT = 'fp-auto-height'; 1068 var AUTO_HEIGHT_SEL = '.fp-auto-height'; 1069 var NORMAL_SCROLL = 'fp-normal-scroll'; 1070 var NORMAL_SCROLL_SEL = '.fp-normal-scroll'; 1071 1072 // section nav 1073 var SECTION_NAV = 'fp-nav'; 1074 var SECTION_NAV_SEL = '#' + SECTION_NAV; 1075 var SECTION_NAV_TOOLTIP = 'fp-tooltip'; 1076 var SECTION_NAV_TOOLTIP_SEL='.'+SECTION_NAV_TOOLTIP; 1077 var SHOW_ACTIVE_TOOLTIP = 'fp-show-active'; 1078 1079 // slide 1080 var SLIDE_DEFAULT_SEL = '.slide';
1081 var SLIDE = 'fp-slide'; 1082 var SLIDE_SEL = '.' + SLIDE; 1083 var SLIDE_ACTIVE_SEL = SLIDE_SEL + ACTIVE_SEL; 1084 var SLIDES_WRAPPER = 'fp-slides'; 1085 var SLIDES_WRAPPER_SEL = '.' + SLIDES_WRAPPER; 1086 var SLIDES_CONTAINER = 'fp-slidesContainer'; 1087 var SLIDES_CONTAINER_SEL = '.' + SLIDES_CONTAINER; 1088 var TABLE = 'fp-table'; 1089 1090 // slide nav 1091 var SLIDES_NAV = 'fp-slidesNav'; 1092 var SLIDES_NAV_SEL = '.' + SLIDES_NAV; 1093 var SLIDES_NAV_LINK_SEL = SLIDES_NAV_SEL + ' a'; 1094 var SLIDES_ARROW = 'fp-controlArrow'; 1095 var SLIDES_ARROW_SEL = '.' + SLIDES_ARROW; 1096 var SLIDES_PREV = 'fp-prev'; 1097 var SLIDES_PREV_SEL = '.' + SLIDES_PREV; 1098 var SLIDES_ARROW_PREV = SLIDES_ARROW + ' ' + SLIDES_PREV; 1099 var SLIDES_ARROW_PREV_SEL = SLIDES_ARROW_SEL + SLIDES_PREV_SEL; 1100 var SLIDES_NEXT = 'fp-next'; 1101 var SLIDES_NEXT_SEL = '.' + SLIDES_NEXT; 1102 var SLIDES_ARROW_NEXT = SLIDES_ARROW + ' ' + SLIDES_NEXT; 1103 var SLIDES_ARROW_NEXT_SEL = SLIDES_ARROW_SEL + SLIDES_NEXT_SEL; 1104 1105 /* nectar addition */ 1106 var HASHCHANGE = false; 1107 var HASHCHANGETIMEOUT; 1108 /* nectar addition end */ 1109 1110 var $window = $(window); 1111 var $document = $(document); 1112 1113 // Default options for iScroll.js used when using scrollOverflow 1114 1115 /* nectar addition */ 1116 //changing click param depending on mobile device 1117 if('ontouchstart' in document.documentElement) { 1118 var iscrollOptions = { 1119 scrollbars: true, 1120 mouseWheel: true, 1121 hideScrollbars: false, 1122 disableMouse: true, 1123 useTransition: true, 1124 interactiveScrollbars: true, 1125 click: true 1126 }; 1127 } else { 1128 var iscrollOptions = { 1129 scrollbars: true, 1130 mouseWheel: true, 1131 hideScrollbars: false, 1132 disableMouse: true, 1133 useTransition: true, 1134 interactiveScrollbars: true, 1135 click: false 1136 }; 1137 } 1138 1139 if($('.nectar_using_pfsr.nectar_pfsr_compose_mode:not(.using-mobile-browser)').length > 0) { 1140 var iscrollOptions = { 1141 scrollbars: true, 1142 mouseWheel: false, 1143 hideScrollbars: false, 1144 useTransition: true, 1145 interactiveScrollbars: true, 1146 disableMouse: true, 1147 disableTouch: true, 1148 disablePointer: false, 1149 click: true 1150 }; 1151 } 1152 1153 1154 $.fn.fullpage = function(options) { 1155 //only once my friend! 1156 if($('html').hasClass(ENABLED)){ displayWarnings(); return; } 1157 1158 1159 1160 // common jQuery objects 1161 var $htmlBody = $('html, body'); 1162 var $body = $('body'); 1163 1164 var FP = $.fn.fullpage; 1165 1166 // Create some defaults, extending them with any options that were provided 1167 options = $.extend({ 1168 //navigation 1169 menu: false, 1170 anchors:[], 1171 lockAnchors: false, 1172 navigation: false, 1173 navigationPosition: 'right', 1174 navigationTooltips: [], 1175 showActiveTooltip: false, 1176 slidesNavigation: false, 1177 slidesNavPosition: 'bottom', 1178 scrollBar: false, 1179 hybrid: false, 1180 1181 //scrolling 1182 css3: true, 1183 scrollingSpeed: 700, 1184 autoScrolling: true, 1185 fitToSection: true, 1186 fitToSectionDelay: 1000, 1187 easing: 'easeInOutCubic', 1188 easingcss3: 'ease', 1189 loopBottom: false, 1190 loopTop: false, 1191 loopHorizontal: true, 1192 continuousVertical: false, 1193 normalScrollElements: null, 1194 scrollOverflow: false, 1195 scrollOverflowHandler: iscrollHandler, 1196 scrollOverflowOptions: null, 1197 touchSensitivity: 5, 1198 normalScrollElementTouchThreshold: 5, 1199 1200 //Accessibility 1201 keyboardScrolling: true, 1202 animateAnchor: true, 1203 recordHistory: true, 1204 1205 //design 1206 controlArrows: true, 1207 controlArrowColor: '#fff', 1208 verticalCentered: true, 1209 sectionsColor : [], 1210 paddingTop: 0, 1211 paddingBottom: 0, 1212 fixedElements: null, 1213 responsive: 0, //backwards compabitility with responsiveWiddth 1214 responsiveWidth: 0, 1215 responsiveHeight: 0, 1216 1217 //Custom selectors 1218 sectionSelector: SECTION_DEFAULT_SEL, 1219 slideSelector: SLIDE_DEFAULT_SEL, 1220 1221 1222 //events 1223 afterLoad: null, 1224 onLeave: null, 1225 afterRender: null, 1226 afterResize: null, 1227 afterReBuild: null, 1228 afterSlideLoad: null, 1229 onSlideLeave: null 1230 }, options); 1231 1232 displayWarnings(); 1233 1234 //extending iScroll options with the user custom ones 1235 iscrollOptions = $.extend(iscrollOptions, options.scrollOverflowOptions); 1236 1237 //easeInOutCubic animation included in the plugin 1238 $.extend($.easing,{ easeInOutCubic: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t*t + b;return c/2*((t-=2)*t*t + 2) + b;}}); 1239 1240 /** 1241 * Sets the autoScroll option. 1242 * It changes the scroll bar visibility and the history of the site as a result. 1243 */ 1244 FP.setAutoScrolling = function(value, type){ 1245 setVariableState('autoScrolling', value, type); 1246 1247 var element = $(SECTION_ACTIVE_SEL); 1248 1249 if(options.autoScrolling && !options.scrollBar){ 1250 $htmlBody.css({ 1251 'overflow' : 'hidden', 1252 'height' : '100%' 1253 }); 1254 1255 FP.setRecordHistory(originals.recordHistory, 'internal'); 1256 1257 //for IE touch devices 1258 container.css({
1259 '-ms-touch-action': 'none', 1260 'touch-action': 'none' 1261 }); 1262 1263 if(element.length){ 1264 //moving the container up 1265 silentScroll(element.position().top); 1266 } 1267 1268 }else{ 1269 $htmlBody.css({ 1270 'overflow' : 'visible', 1271 'height' : 'initial' 1272 }); 1273 1274 FP.setRecordHistory(false, 'internal'); 1275 1276 //for IE touch devices 1277 container.css({ 1278 '-ms-touch-action': '', 1279 'touch-action': '' 1280 }); 1281 1282 silentScroll(0); 1283 1284 //scrolling the page to the section with no animation 1285 if (element.length) { 1286 1287 $htmlBody.scrollTop(element.position().top); 1288 } 1289 } 1290 }; 1291 1292 /** 1293 * Defines wheter to record the history for each hash change in the URL. 1294 */ 1295 FP.setRecordHistory = function(value, type){ 1296 setVariableState('recordHistory', value, type); 1297 }; 1298 1299 /** 1300 * Defines the scrolling speed 1301 */ 1302 FP.setScrollingSpeed = function(value, type){ 1303 setVariableState('scrollingSpeed', value, type); 1304 }; 1305 1306 /** 1307 * Sets fitToSection 1308 */ 1309 FP.setFitToSection = function(value, type){ 1310 setVariableState('fitToSection', value, type); 1311 }; 1312 1313 /** 1314 * Sets lockAnchors 1315 */ 1316 FP.setLockAnchors = function(value){ 1317 options.lockAnchors = value; 1318 }; 1319 1320 /** 1321 * Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad. 1322 */ 1323 FP.setMouseWheelScrolling = function (value){ 1324 if(value){ 1325 addMouseWheelHandler(); 1326 addMiddleWheelHandler(); 1327 }else{ 1328 removeMouseWheelHandler(); 1329 removeMiddleWheelHandler(); 1330 } 1331 }; 1332 1333 /** 1334 * Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures. 1335 * Optionally a second parameter can be used to specify the direction for which the action will be applied. 1336 * 1337 * @param directions string containing the direction or directions separated by comma. 1338 */ 1339 FP.setAllowScrolling = function (value, directions){ 1340 if(typeof directions !== 'undefined'){ 1341 directions = directions.replace(/ /g,'').split(','); 1342 1343 $.each(directions, function (index, direction){ 1344 setIsScrollAllowed(value, direction, 'm'); 1345 }); 1346 } 1347 else if(value){ 1348 FP.setMouseWheelScrolling(true); 1349 addTouchHandler(); 1350 }else{ 1351 FP.setMouseWheelScrolling(false); 1352 removeTouchHandler(); 1353 } 1354 }; 1355 1356 /** 1357 * Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys 1358 */ 1359 FP.setKeyboardScrolling = function (value, directions){ 1360 if(typeof directions !== 'undefined'){ 1361 directions = directions.replace(/ /g,'').split(','); 1362 1363 $.each(directions, function (index, direction){ 1364 setIsScrollAllowed(value, direction, 'k'); 1365 }); 1366 }else{ 1367 options.keyboardScrolling = value; 1368 } 1369 }; 1370 1371 /** 1372 * Moves the page up one section. 1373 */ 1374 FP.moveSectionUp = function(){ 1375 1376 /* nectar addition */ 1377 if(canScroll == false) return false; 1378 1379 var prev = $(SECTION_ACTIVE_SEL).prev(SECTION_SEL); 1380 1381 //looping to the bottom if there's no more sections above 1382 if (!prev.length && (options.loopTop || options.continuousVertical)) {
1383 prev = $(SECTION_SEL).last(); 1384 } 1385 1386 if (prev.length) { 1387 scrollPage(prev, null, true); 1388 } 1389 }; 1390 1391 /** 1392 * Moves the page down one section. 1393 */ 1394 FP.moveSectionDown = function (){ 1395 1396 /* nectar addition */ 1397 if(canScroll == false) return false; 1398 1399 var next = $(SECTION_ACTIVE_SEL).next(SECTION_SEL); 1400 1401 //looping to the top if there's no more sections below 1402 if(!next.length && 1403 (options.loopBottom || options.continuousVertical)){ 1404 next = $(SECTION_SEL).first(); 1405 } 1406 1407 if(next.length){ 1408 scrollPage(next, null, false); 1409 } 1410 }; 1411 1412 /** 1413 * Moves the page to the given section and slide with no animation. 1414 * Anchors or index positions can be used as params. 1415 */ 1416 FP.silentMoveTo = function(sectionAnchor, slideAnchor){ 1417 FP.setScrollingSpeed (0, 'internal'); 1418 FP.moveTo(sectionAnchor, slideAnchor); 1419 FP.setScrollingSpeed (originals.scrollingSpeed, 'internal'); 1420 }; 1421 1422 /** 1423 * Moves the page to the given section and slide. 1424 * Anchors or index positions can be used as params. 1425 */ 1426 FP.moveTo = function (sectionAnchor, slideAnchor){ 1427 var destiny = getSectionByAnchor(sectionAnchor); 1428 1429 if (typeof slideAnchor !== 'undefined'){ 1430 scrollPageAndSlide(sectionAnchor, slideAnchor); 1431 }else if(destiny.length > 0){ 1432 scrollPage(destiny); 1433 } 1434 }; 1435 1436 /** 1437 * Slides right the slider of the active section. 1438 * Optional `section` param. 1439 */ 1440 FP.moveSlideRight = function(section){ 1441 moveSlide('next', section); 1442 }; 1443 1444 /** 1445 * Slides left the slider of the active section. 1446 * Optional `section` param. 1447 */ 1448 FP.moveSlideLeft = function(section){ 1449 moveSlide('prev', section); 1450 }; 1451 1452 /** 1453 * When resizing is finished, we adjust the slides sizes and positions 1454 */ 1455 FP.reBuild = function(resizing){ 1456 1457 if(container.hasClass(DESTROYED)){ return; } //nothing to do if the plugin was destroyed 1458 1459 isResizing = true; 1460 1461 /* nectar addition */ 1462 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight(); 1463 var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar 1464 if(window.vc_iframe) { $adminBar = 0; } 1465 var $headerHeight = ($('#header-outer.transparent').length == 0 ) ? $headerNavSpace : 0 ; 1466 // Handle mobile secondary nav 1467 if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) { 1468 $headerHeight += $('#header-secondary-outer').height(); 1469 } 1470 var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2; 1471 var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0; 1472 var windowsWidth = $window.outerWidth(); 1473 var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap 1474 windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra; //updating global var 1475 1476 $(SECTION_SEL).each(function(){ 1477 var slidesWrap = $(this).find(SLIDES_WRAPPER_SEL); 1478 var slides = $(this).find(SLIDE_SEL); 1479 1480 //adjusting the height of the table-cell for IE and Firefox 1481 if(options.verticalCentered){ 1482 $(this).find(TABLE_CELL_SEL).css('height', getTableHeight($(this)) + 'px'); 1483 } 1484 1485 $(this).css('height', windowsHeight + 'px'); 1486 1487 1488 //adjusting the position fo the FULL WIDTH slides... 1489 if (slides.length > 1) {
1490 landscapeScroll(slidesWrap, slidesWrap.find(SLIDE_ACTIVE_SEL)); 1491 } 1492 }); 1493 1494 /* nectar addition */ 1495 if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0) { 1496 $('#nectar_fullscreen_rows').css('height', windowsHeight + 'px'); 1497 } 1498 1499 //middle alignment of rows when desktop scroll overflow is turned off 1500 if($('#nectar_fullscreen_rows[data-content-overflow="hidden"]').length > 0) { 1501 $('#nectar_fullscreen_rows>.vc_row.vc_row-flex:not(#footer-outer)>.fp-tableCell>.full-page-inner-wrap-outer>.full-page-inner-wrap[data-content-pos="middle"] > .full-page-inner>.container>.span_12').css('height', windowsHeight + 'px'); 1502 $('#nectar_fullscreen_rows>.vc_row.vc_row-flex:not(#footer-outer)>.fp-tableCell>.full-page-inner-wrap-outer>.full-page-inner-wrap[data-content-pos="middle"]').css('overflow', 'hidden'); 1503 } 1504 1505 var activeSection = $(SECTION_ACTIVE_SEL); 1506 var sectionIndex = activeSection.index(SECTION_SEL); 1507 1508 //isn't it the first section? 1509 if(sectionIndex){ 1510 //adjusting the position for the current section 1511 FP.silentMoveTo(sectionIndex + 1); 1512 1513 } 1514 1515 isResizing = false; 1516 $.isFunction( options.afterResize ) && resizing && options.afterResize.call(container); 1517 $.isFunction( options.afterReBuild ) && !resizing && options.afterReBuild.call(container); 1518 }; 1519 1520 /** 1521 * Turns fullPage.js to normal scrolling mode when the viewport `width` or `height` 1522 * are smaller than the set limit values. 1523 */ 1524 FP.setResponsive = function (active){ 1525 var isResponsive = $body.hasClass(RESPONSIVE); 1526 1527 if(active){ 1528 if(!isResponsive){ 1529 FP.setAutoScrolling(false, 'internal'); 1530 FP.setFitToSection(false, 'internal'); 1531 $(SECTION_NAV_SEL).hide(); 1532 $body.addClass(RESPONSIVE); 1533 } 1534 } 1535 else if(isResponsive){ 1536 FP.setAutoScrolling(originals.autoScrolling, 'internal'); 1537 FP.setFitToSection(originals.autoScrolling, 'internal'); 1538 $(SECTION_NAV_SEL).show(); 1539 $body.removeClass(RESPONSIVE); 1540 } 1541 }; 1542 1543 //flag to avoid very fast sliding for landscape sliders 1544 var slideMoving = false; 1545 1546 var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/); 1547 var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints)); 1548 var container = $(this); 1549 /* nectar addition */ 1550 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight(); 1551 var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar 1552 if(window.vc_iframe) { $adminBar = 0; } 1553 var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2; 1554 var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0; 1555 var $headerHeight = ($('#header-outer.transparent').length == 0) ? $headerNavSpace : 0 ; 1556 if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) { 1557 $headerHeight += $('#header-secondary-outer').height(); 1558 } 1559 var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap 1560 var windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra; 1561 var isResizing = false; 1562 var isWindowFocused = true; 1563 var lastScrolledDestiny; 1564 var lastScrolledSlide; 1565 var canScroll = true; 1566 var scrollings = []; 1567 var nav; 1568 var controlPressed; 1569 var isScrollAllowed = {}; 1570 isScrollAllowed.m = { 'up':true, 'down':true, 'left':true, 'right':true }; 1571 isScrollAllowed.k = $.extend(true,{}, isScrollAllowed.m); 1572 var originals = $.extend(true, {}, options); //deep copy 1573 1574 //timeouts 1575 var resizeId; 1576 var afterSectionLoadsId; 1577 var afterSlideLoadsId; 1578 var scrollId; 1579 var scrollId2;
1580 var keydownId; 1581 1582 if($(this).length){ 1583 init(); 1584 bindEvents(); 1585 } 1586 1587 function init(){ 1588 //if css3 is not supported, it will use jQuery animations 1589 if(options.css3){ 1590 options.css3 = support3d(); 1591 } 1592 1593 options.scrollBar = options.scrollBar || options.hybrid; 1594 1595 1596 setOptionsFromDOM(); 1597 1598 prepareDom(); 1599 FP.setAllowScrolling(true); 1600 1601 FP.setAutoScrolling(options.autoScrolling, 'internal'); 1602 1603 //the starting point is a slide? 1604 var activeSlide = $(SECTION_ACTIVE_SEL).find(SLIDE_ACTIVE_SEL); 1605 1606 //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/slide by default. 1607 if( activeSlide.length && ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) !== 0 || ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) === 0 && activeSlide.index() !== 0))){ 1608 silentLandscapeScroll(activeSlide); 1609 } 1610 1611 responsive(); 1612 1613 //setting the class for the body element 1614 setBodyClass(); 1615 1616 if(document.readyState === 'complete'){ 1617 scrollToAnchor(); 1618 } 1619 $window.on('load', scrollToAnchor); 1620 } 1621 1622 function bindEvents(){ 1623 $window 1624 //when scrolling... 1625 .on('scroll', scrollHandler) 1626 1627 //detecting any change on the URL to scroll to the given anchor link 1628 //(a way to detect back history button as we play with the hashes on the URL) 1629 .on('hashchange', hashChangeHandler) 1630 1631 //when opening a new tab (ctrl + t), `control` won't be pressed when comming back. 1632 .blur(blurHandler) 1633 1634 //when resizing the site, we adjust the heights of the sections, slimScroll... 1635 .resize(resizeHandler) 1636 /* nectar addition */ 1637 .smartresize(checkScrollOverflow); 1638 $(window).on( 'vc_reload',function(){ 1639 1640 var currentRowIndex = ($('.fp-table.active').length > 0) ? $('.fp-table.active').index() + 1 : 'default'; 1641 1642 $('#nectar_fullscreen_rows > div.vc_element').addClass('fp-section'); 1643 $('#nectar_fullscreen_rows > div.vc_element').each(function(){ 1644 if( $(this).find('> .wpb_row > .fp-tableCell').length == 0 ) { 1645 currentRowIndex = $(this).index() + 1; 1646 addTableClass( $(this) ); 1647 } 1648 }); 1649 1650 if(currentRowIndex != 'default') { 1651 FP.silentMoveTo(currentRowIndex); 1652 1653 //$('#fp-nav ul > li:nth-child(' + (currentRowIndex) + ')').find('> a').trigger('click'); 1654 //FP.reBuild(true); 1655 } 1656 1657 1658 }); 1659 $document 1660 //Sliding with arrow keys, both, vertical and horizontal 1661 .keydown(keydownHandler) 1662 1663 //to prevent scrolling while zooming 1664 .keyup(keyUpHandler) 1665 1666 //Scrolls to the section when clicking the navigation bullet 1667 .on('click touchstart', SECTION_NAV_SEL + ' a', sectionBulletHandler) 1668 1669 //Scrolls the slider to the given slide destination for the given section 1670 .on('click touchstart', SLIDES_NAV_LINK_SEL, slideBulletHandler) 1671 1672 .on('click', SECTION_NAV_TOOLTIP_SEL, tooltipTextHandler); 1673 1674 //Scrolling horizontally when clicking on the slider controls. 1675 $(SECTION_SEL).on('click touchstart', SLIDES_ARROW_SEL, slideArrowHandler); 1676 1677 /** 1678 * Applying normalScroll elements. 1679 * Ignoring the scrolls over the specified selectors. 1680 */ 1681 if(options.normalScrollElements){ 1682 $document.on('mouseenter', options.normalScrollElements, function () { 1683 FP.setMouseWheelScrolling(false); 1684 }); 1685 1686 $document.on('mouseleave', options.normalScrollElements, function(){ 1687 FP.setMouseWheelScrolling(true); 1688 }); 1689 } 1690 } 1691 1692 /** 1693 * Setting options from DOM elements if they are not provided. 1694 */ 1695 function setOptionsFromDOM(){ 1696 var sections = container.find(options.sectionSelector); 1697 1698 //no anchors option? Checking for them in the DOM attributes 1699 if(!options.anchors.length){ 1700 options.anchors = sections.filter('[data-anchor]').map(function(){ 1701 return $(this).data('anchor').toString(); 1702 }).get(); 1703 } 1704 1705 //no tooltipos option? Checking for them in the DOM attributes 1706 if(!options.navigationTooltips.length){ 1707 options.navigationTooltips = sections.filter('[data-tooltip]').map(function(){ 1708 return $(this).data('tooltip').toString(); 1709 }).get(); 1710 } 1711 } 1712 1713 /** 1714 * Works over the DOM structure to set it up for the current fullpage optionss. 1715 */ 1716 function prepareDom(){ 1717 container.css({ 1718 'height': '100%', 1719 'position': 'relative' 1720 }); 1721 1722 //adding a class to recognize the container internally in the code 1723 container.addClass(WRAPPER); 1724 $('html').addClass(ENABLED); 1725 1726 //due to https://github.com/alvarotrigo/fullPage.js/issues/1502 1727 /* nectar addition */ 1728 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight(); 1729 var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar 1730 if(window.vc_iframe) { $adminBar = 0; } 1731 var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2; 1732 var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0; 1733 var $headerHeight = ($('#header-outer.transparent').length == 0 ) ? $headerNavSpace : 0 ; 1734 if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) { 1735 $headerHeight += $('#header-secondary-outer').height(); 1736 } 1737 var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap 1738 windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra; 1739 1740 container.removeClass(DESTROYED); //in case it was destroyed before initilizing it again 1741 1742 addInternalSelectors(); 1743 1744 //styling the sections / slides / menu 1745 $(SECTION_SEL).each(function(index){ 1746 var section = $(this); 1747 var slides = section.find(SLIDE_SEL); 1748 var numSlides = slides.length; 1749 1750 styleSection(section, index); 1751 styleMenu(section, index); 1752 1753 // if there's any slide 1754 if (numSlides > 0) { 1755 styleSlides(section, slides, numSlides); 1756 }else{ 1757 if(options.verticalCentered){ 1758 addTableClass(section); 1759 } 1760 } 1761 }); 1762 1763 //fixed elements need to be moved out of the plugin container due to problems with CSS3. 1764 if(options.fixedElements && options.css3){ 1765 $(options.fixedElements).appendTo($body); 1766 } 1767 1768 //vertical centered of the navigation + active bullet 1769 if(options.navigation){ 1770 addVerticalNavigation(); 1771 } 1772 1773 enableYoutubeAPI(); 1774 enableVidemoAPI(); 1775 1776 if(options.scrollOverflow){ 1777 if(document.readyState === 'complete'){ 1778 createSlimScrollingHandler(); 1779 } 1780 //after DOM and images are loaded 1781 /* nectar addition */ 1782 afterRenderActions(); 1783 //$window.on('load', createSlimScrollingHandler); 1784 $window.on('load', function() { setTimeout(function(){ 1785 1786 $(SECTION_SEL).each(function(){ 1787 var slides = $(this).find(SLIDE_SEL); 1788 1789 if(slides.length){ 1790 slides.each(function(){ 1791 createSlimScrolling($(this)); 1792 }); 1793 }else{ 1794 createSlimScrolling($(this)); 1795 } 1796 1797 }); 1798 1799 },100); }); 1800 }else{ 1801 afterRenderActions(); 1802 } 1803 } 1804 1805 /** 1806 * Styles the horizontal slides for a section. 1807 */ 1808 function styleSlides(section, slides, numSlides){ 1809 var sliderWidth = numSlides * 100; 1810 var slideWidth = 100 / numSlides; 1811 1812 slides.wrapAll('<div class="' + SLIDES_CONTAINER + '" />'); 1813 slides.parent().wrap('<div class="' + SLIDES_WRAPPER + '" />'); 1814 1815 section.find(SLIDES_CONTAINER_SEL).css('width', sliderWidth + '%'); 1816 1817 if(numSlides > 1){ 1818 if(options.controlArrows){ 1819 createSlideArrows(section); 1820 } 1821 1822 if(options.slidesNavigation){ 1823 addSlidesNavigation(section, numSlides); 1824 } 1825 } 1826 1827 slides.each(function(index) { 1828 $(this).css('width', slideWidth + '%'); 1829 1830 if(options.verticalCentered){ 1831 addTableClass($(this)); 1832 } 1833 }); 1834 1835 var startingSlide = section.find(SLIDE_ACTIVE_SEL); 1836 1837 //if the slide won't be an starting point, the default will be the first one 1838 //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/sl
1838ide by default. 1839 if( startingSlide.length && ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) !== 0 || ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) === 0 && startingSlide.index() !== 0))){ 1840 silentLandscapeScroll(startingSlide); 1841 }else{ 1842 slides.eq(0).addClass(ACTIVE); 1843 } 1844 } 1845 1846 /** 1847 * Styling vertical sections 1848 */ 1849 function styleSection(section, index){ 1850 //if no active section is defined, the 1st one will be the default one 1851 if(!index && $(SECTION_ACTIVE_SEL).length === 0) { 1852 section.addClass(ACTIVE); 1853 } 1854 1855 section.css('height', windowsHeight + 'px'); 1856 1857 /* nectar addition */ 1858 if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0) { 1859 $('#nectar_fullscreen_rows').css('height', windowsHeight + 'px'); 1860 } 1861 if($('#nectar_fullscreen_rows[data-content-overflow="hidden"]').length > 0) $('#nectar_fullscreen_rows>.vc_row.vc_row-flex:not(#footer-outer)>.fp-tableCell>.full-page-inner-wrap-outer>.full-page-inner-wrap[data-content-pos="middle"] > .full-page-inner>.container>.span_12').css('height', windowsHeight + 'px'); 1862 1863 if(options.paddingTop){ 1864 section.css('padding-top', options.paddingTop); 1865 } 1866 1867 if(options.paddingBottom){ 1868 section.css('padding-bottom', options.paddingBottom); 1869 } 1870 1871 if (typeof options.sectionsColor[index] !== 'undefined') { 1872 section.css('background-color', options.sectionsColor[index]); 1873 } 1874 1875 if (typeof options.anchors[index] !== 'undefined') { 1876 section.attr('data-anchor', options.anchors[index]); 1877 } 1878 1879 /* nectar addition */ 1880 $(window).load(function(){ 1881 $(window).trigger('resize'); 1882 }); 1883 } 1884 1885 /** 1886 * Sets the data-anchor attributes to the menu elements and activates the current one. 1887 */ 1888 function styleMenu(section, index){ 1889 if (typeof options.anchors[index] !== 'undefined') { 1890 //activating the menu / nav element on load 1891 if(section.hasClass(ACTIVE)){ 1892 activateMenuAndNav(options.anchors[index], index); 1893 } 1894 } 1895 1896 //moving the menu outside the main container if it is inside (avoid problems with fixed positions when using CSS3 tranforms) 1897 if(options.menu && options.css3 && $(options.menu).closest(WRAPPER_SEL).length){ 1898 $(options.menu).appendTo($body); 1899 } 1900 } 1901 1902 /** 1903 * Adds internal classes to be able to provide customizable selectors 1904 * keeping the link with the style sheet. 1905 */ 1906 function addInternalSelectors(){ 1907 //adding internal class names to void problem with common ones 1908 $(options.sectionSelector).each(function(){ 1909 $(this).addClass(SECTION); 1910 }); 1911 $(options.slideSelector).each(function(){ 1912 $(this).addClass(SLIDE); 1913 }); 1914 } 1915 1916 /** 1917 * Creates the control arrows for the given section 1918 */ 1919 function createSlideArrows(section){ 1920 section.find(SLIDES_WRAPPER_SEL).after('<div class="' + SLIDES_ARROW_PREV + '"></div><div class="' + SLIDES_ARROW_NEXT + '"></div>'); 1921 1922 if(options.controlArrowColor!='#fff'){ 1923 section.find(SLIDES_ARROW_NEXT_SEL).css('border-color', 'transparent transparent transparent '+options.controlArrowColor); 1924 section.find(SLIDES_ARROW_PREV_SEL).css('border-color', 'transparent '+ options.controlArrowColor + ' transparent transparent'); 1925 } 1926 1927 if(!options.loopHorizontal){ 1928 section.find(SLIDES_ARROW_PREV_SEL).hide(); 1929 } 1930 } 1931 1932 /** 1933 * Creates a vertical navigation bar. 1934 */ 1935 /* nectar addition */ 1936 function addVerticalNavigation(){ 1937 if($('#nectar_fullscreen_rows').attr('data-dot-navigation') == 'hidden') { return; } 1938 1939 if($('#boxed').length > 0) { 1940 $('#boxed').append('<div id="' + SECTION_NAV + '" class="'+$('#nectar_fullscreen_rows').attr('data-dot-navigation')+'"><ul></ul></div>'); 1941 } 1942 else { 1943 $body.append('<div id="' + SECTION_NAV + '" class="'+$('#nectar_fullscreen_rows').attr('data-dot-navigation')+'"><ul></ul></div>'); 1944 } 1945 1946 var nav = $(SECTION_NAV_SEL); 1947 1948 nav.addClass(function() { 1949 return options.showActiveTooltip ? SHOW_ACTIVE_TOOLTIP + ' ' + options.navigationPosition : options.navigationPosition; 1950 }); 1951 1952 for (var i = 0; i < $(SECTION_SEL).length; i++) { 1953 1954 var link = ''; 1955 if (options.anchors.length) { 1956 link = options.anchors[i]; 1957 } 1958 1959 var li = '<li><a href="#' + link + '"><span></span></a>'; 1960 1961 // Only add tooltip if needed (defined by user) 1962 var tooltip = options.navigationTooltips[i]; 1963 1964 if (typeof tooltip !== 'undefined' && tooltip !== '') { 1965 1966 if(tooltip.length == 1) { 1967 li += '<div class="' + SECTION_NAV_TOOLTIP + ' ' + options.navigationPosition + '"></div>'; 1968 } 1969 else { 1970 li += '<div class="' + SECTION_NAV_TOOLTIP + ' ' + options.navigationPosition + '"><div class="tooltip-inner"><span>' + tooltip + '</span></div></div>'; 1971 } 1972 } 1973 1974 li += '</li>'; 1975 1976 nav.find('ul').append(li); 1977 } 1978 1979 /*nectar addition - front end editor create new section control */ 1980 if(window.vc_iframe) { 1981 var $addnewElClone = $('#nectar_fullscreen_rows > #vc_no-content-helper').clone(); 1982 setTimeout(function(){ 1983 $('#fp-nav ul').append('<li class="vc_add_new_row"><a href="#">
1983' + $addnewElClone.find('#vc_not-empty-add-element').html() + '</a> <div class="fp-tooltip right"><div class="tooltip-inner"><span>Add New Section</span></div></div> </li>'); 1984 },300); 1985 1986 $('body').off('click.vc_fp_new_section_rel'); 1987 $('body').on('click.vc_fp_new_section_rel','#fp-nav ul .vc-c-icon-add',function(e) { 1988 $('#nectar_fullscreen_rows > #vc_no-content-helper #vc_not-empty-add-element .vc-c-icon-add').trigger('click'); 1989 e.preventDefault(); 1990 return false; 1991 }); 1992 } 1993 /*nectar addition end */ 1994 1995 //centering it vertically 1996 $(SECTION_NAV_SEL).css('margin-top', '-' + (($(SECTION_NAV_SEL).height()/2) - $adminBar - $headerHeight/2) + 'px'); 1997 1998 //activating the current active section 1999 $(SECTION_NAV_SEL).find('li').eq($(SECTION_ACTIVE_SEL).index(SECTION_SEL)).find('a').addClass(ACTIVE); 2000 2001 if($('#nectar_fullscreen_rows[data-footer="last_row"]').length > 0 || $('#nectar_fullscreen_rows[data-footer="default"]').length > 0) { 2002 nav.find('ul li:last-child').remove(); 2003 } 2004 } 2005 2006 /** 2007 * Creates the slim scroll scrollbar for the sections and slides inside them. 2008 */ 2009 function createSlimScrollingHandler(){ 2010 2011 $(SECTION_SEL).each(function(){ 2012 var slides = $(this).find(SLIDE_SEL); 2013 2014 if(slides.length){ 2015 slides.each(function(){ 2016 createSlimScrolling($(this)); 2017 }); 2018 }else{ 2019 createSlimScrolling($(this)); 2020 } 2021 2022 }); 2023 2024 afterRenderActions(); 2025 } 2026 2027 /* 2028 * Enables the Youtube videos API so we can control their flow if necessary. 2029 */ 2030 function enableYoutubeAPI(){ 2031 container.find('iframe[src*="youtube.com/embed/"]').each(function(){ 2032 var sign = getUrlParamSign($(this).attr('src')); 2033 $(this).attr('src', $(this).attr('src') + sign + 'enablejsapi=1'); 2034 }); 2035 } 2036 2037 /* 2038 * Enables the Vimeo videos API so we can control their flow if necessary. 2039 */ 2040 function enableVidemoAPI(){ 2041 container.find('iframe[src*="player.vimeo.com/"]').each(function(){ 2042 var sign = getUrlParamSign($(this).attr('src')); 2043 $(this).attr('src', $(this).attr('src') + sign + 'api=1'); 2044 }); 2045 } 2046 2047 /* 2048 * Returns the prefix sign to use for a new parameter in an existen URL. 2049 * 2050 * @return {String} ? | & 2051 */ 2052 function getUrlParamSign(url){ 2053 return ( !/\?/.test( url ) ) ? '?' : '&'; 2054 } 2055 2056 /** 2057 * Actions and callbacks to fire afterRender 2058 */ 2059 function afterRenderActions(){ 2060 var section = $(SECTION_ACTIVE_SEL); 2061 2062 section.addClass(COMPLETELY); 2063 2064 if(options.scrollOverflowHandler.afterRender){ 2065 options.scrollOverflowHandler.afterRender(section); 2066 } 2067 lazyLoad(section); 2068 playMedia(section); 2069 2070 $.isFunction( options.afterLoad ) && options.afterLoad.call(section, section.data('anchor'), (section.index(SECTION_SEL) + 1)); 2071 $.isFunction( options.afterRender ) && options.afterRender.call(container); 2072 } 2073 2074 2075 var isScrolling = false; 2076 var lastScroll = 0; 2077 2078 //when scrolling... 2079 function scrollHandler(){ 2080 var currentSection; 2081 2082 if(!options.autoScrolling || options.scrollBar){ 2083 var currentScroll = $window.scrollTop(); 2084 var scrollDirection = getScrollDirection(currentScroll); 2085 var visibleSectionIndex = 0; 2086 var screen_mid = currentScroll + ($window.height() / 2.0); 2087 2088 //taking the section which is showing more content in the viewport 2089 var sections = document.querySelectorAll(SECTION_SEL); 2090 for (var i = 0; i < sections.length; ++i) { 2091 var section = sections[i]; 2092 2093 // Pick the the last section which passes the middle line of the screen. 2094 if (section.offsetTop <= screen_mid) 2095 { 2096 visibleSectionIndex = i; 2097 } 2098 } 2099 2100 if(isCompletelyInViewPort(scrollDirection)){ 2101 if(!$(SECTION_ACTIVE_SEL).hasClass(COMPLETELY)){ 2102 $(SECTION_ACTIVE_SEL).addClass(COMPLETELY).siblings().removeClass(COMPLETELY); 2103 } 2104 } 2105 2106 //geting the last one, the current one on the screen 2107 currentSection = $(sections).eq(visibleSectionIndex); 2108 2109 //setting the visible section as active when manually scrolling 2110 //executing only once the first time we reach the section 2111 if(!currentSection.hasClass(ACTIVE)){ 2112 isScrolling = true; 2113 var leavingSection = $(SECTION_ACTIVE_SEL); 2114 var leavingSectionIndex = leavingSection.index(SECTION_SEL) + 1; 2115 var yMovement = getYmovement(currentSection); 2116 var anchorLink = currentSection.data('anchor'); 2117 var sectionIndex = currentSection.index(SECTION_SEL) + 1; 2118 var activeSlide = currentSection.find(SLIDE_ACTIVE_SEL); 2119 2120 if(activeSlide.length){ 2121 var slideAnchorLink = activeSlide.data('anchor'); 2122 var slideIndex = activeSlide.index(); 2123 } 2124 2125 if(canScroll){ 2126 currentSection.addClass(ACTIVE).siblings().removeClass(ACTIVE); 2127 2128 $.isFunction( options.onLeave ) && options.onLeave.call( leavingSection, leavingSectionIndex, sectionIndex, yMovement); 2129 2130 $.isFunction( options.afterLoad ) && options.afterLoad.call( currentSection, anchorLink, sectionIndex); 2131 lazyLoad(currentSection); 2132 2133 activateMenuAndNav(anchorLink, sectionIndex - 1); 2134 2135 if(options.anchors.length){ 2136 //needed to enter in hashChange event when using the menu with anchor links 2137 lastScrolledDestiny = anchorLink; 2138 2139 setState(slideIndex, slideAnchorLink, anchorLink, sectionIndex); 2140 } 2141 } 2142 2143 //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet 2144 clearTimeout(scrollId); 2145 scrollId = setTimeout(function(){ 2146 isScrolling = false; 2147 }, 100); 2148 } 2149 2150 if(options.fitToSection){ 2151 //for the auto adjust of the viewport to fit a whole section 2152 clearTimeout(scrollId2); 2153 2154 scrollId2 = setTimeout(function(){ 2155 //checking fitToSection again in case it was set to false before the timeout delay 2156 if(canScroll && options.fitToSection){ 2157 //allows to scroll to an active section and 2158 //if the section is already active, we prevent firing callbacks 2159 if($(SECTION_ACTIVE_SEL).is(currentSection)){ 2160 isResizing = true; 2161 } 2162 scrollPage($(SECTION_ACTIVE_SEL)); 2163 2164 isResizing = false; 2165 } 2166 }, options.fitToSectionDelay); 2167 } 2168 } 2169 } 2170 2171 /** 2172 * Determines whether the active section has seen in its whole or not. 2173 */ 2174 function isCompletelyInViewPort(movement){ 2175 var top = $(SECTION_ACTIVE_SEL).position().top; 2176 var bottom = top + $window.height(); 2177 2178 if(movement == 'up'){ 2179 return bottom >= ($window.scrollTop() + $window.height()); 2180 } 2181 return top <= $window.scrollTop(); 2182 } 2183 2184 /** 2185 * Gets the directon of the the scrolling fired by the scroll event. 2186 */ 2187 function getScrollDirection(currentScroll){ 2188 var direction = currentScroll > lastScroll ? 'down' : 'up'; 2189 2190 lastScroll = currentScroll; 2191 2192 return direction; 2193 } 2194 2195 /** 2196 * Determines the way of scrolling up or down: 2197 * by 'automatically' scrolling a section or by using the default and n
2197ormal scrolling. 2198 */ 2199 function scrolling(type, scrollable){ 2200 /* nectar addition */ 2201 if (!isScrollAllowed.m[type] || $('#slide-out-widget-area.open[class*="fullscreen"]').length > 0){ 2202 return; 2203 } 2204 /* nectar addition end */ 2205 var check, scrollSection; 2206 2207 if(type == 'down'){ 2208 check = 'bottom'; 2209 scrollSection = FP.moveSectionDown; 2210 }else{ 2211 check = 'top'; 2212 scrollSection = FP.moveSectionUp; 2213 } 2214 2215 if(scrollable.length > 0 ){ 2216 //is the scrollbar at the start/end of the scroll? 2217 if(options.scrollOverflowHandler.isScrolled(check, scrollable)){ 2218 2219 //* nectar addition */ 2220 if( $('#nectar_fullscreen_rows.nextSectionAllowed').length > 0) { 2221 scrollSection(); 2222 } 2223 setTimeout(function(){ $('#nectar_fullscreen_rows').addClass('nextSectionAllowed'); },150); 2224 }else{ 2225 return true; 2226 } 2227 }else{ 2228 // moved up/down 2229 scrollSection(); 2230 } 2231 } 2232 2233 2234 var touchStartY = 0; 2235 var touchStartX = 0; 2236 var touchEndY = 0; 2237 var touchEndX = 0; 2238 2239 /* Detecting touch events 2240 2241 * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it. 2242 * This way, the touchstart and the touch moves shows an small difference between them which is the 2243 * used one to determine the direction. 2244 */ 2245 function touchMoveHandler(event){ 2246 var e = event.originalEvent; 2247 2248 // additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain 2249 if (!checkParentForNormalScrollElement(event.target) && isReallyTouch(e) ) { 2250 2251 if(options.autoScrolling){ 2252 //preventing the easing on iOS devices 2253 event.preventDefault(); 2254 } 2255 2256 var activeSection = $(SECTION_ACTIVE_SEL); 2257 var scrollable = options.scrollOverflowHandler.scrollable(activeSection); 2258 2259 if (canScroll && !slideMoving) { //if theres any # 2260 var touchEvents = getEventsPage(e); 2261 2262 touchEndY = touchEvents.y; 2263 touchEndX = touchEvents.x; 2264 2265 //if movement in the X axys is greater than in the Y and the currect section has slides... 2266 if (activeSection.find(SLIDES_WRAPPER_SEL).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { 2267 2268 //is the movement greater than the minimum resistance to scroll? 2269 if (Math.abs(touchStartX - touchEndX) > ($window.outerWidth() / 100 * options.touchSensitivity)) { 2270 if (touchStartX > touchEndX) { 2271 if(isScrollAllowed.m.right){ 2272 FP.moveSlideRight(); //next 2273 } 2274 } else { 2275 if(isScrollAllowed.m.left){ 2276 FP.moveSlideLeft(); //prev 2277 } 2278 } 2279 } 2280 } 2281 2282 //vertical scrolling (only when autoScrolling is enabled) 2283 else if(options.autoScrolling){ 2284 2285 //is the movement greater than the minimum resistance to scroll? 2286 if (Math.abs(touchStartY - touchEndY) > ($window.height() / 100 * options.touchSensitivity)) { 2287 if (touchStartY > touchEndY) { 2288 scrolling('down', scrollable); 2289 } else if (touchEndY > touchStartY) { 2290 scrolling('up', scrollable); 2291 } 2292 } 2293 } 2294 } 2295 } 2296 2297 } 2298 2299 /** 2300 * recursive function to loop up the parent nodes to check if one of them exists in options.normalScrollElements 2301 * Currently works well for iOS - Android might need some testing 2302 * @param {Element} el target element / jquery selector (in subsequent nodes) 2303 * @param {int} hop current hop compared to options.normalScrollElementTouchThreshold 2304 * @return {boolean} true if there is a match to options.normalScrollElements 2305 */ 2306 function checkParentForNormalScrollElement (el, hop) { 2307 hop = hop || 0; 2308 var parent = $(el).parent(); 2309 2310 if (hop < options.normalScrollElementTouchThreshold && 2311 parent.is(options.normalScrollElements) ) { 2312 return true; 2313 } else if (hop == options.normalScrollElementTouchThreshold) { 2314 return false; 2315 } else { 2316 return checkParentForNormalScrollElement(parent, ++hop); 2317 } 2318 } 2319 2320 /** 2321 * As IE >= 10 fires both touch and mouse events when using a mouse in a touchscreen 2322 * this way we make sure that is really a touch event what IE is detecting. 2323 */ 2324 function isReallyTouch(e){ 2325 //if is not IE || IE is detecting `touch` or `pen` 2326 return typeof e.pointerType === 'undefined' || e.pointerType != 'mouse'; 2327 } 2328 2329 /** 2330 * Handler for the touch start event. 2331 */ 2332 function touchStartHandler(event){ 2333 var e = event.originalEvent; 2334 2335 //stopping the auto scroll to adjust to a section 2336 if(options.fitToSection){ 2337 $htmlBody.stop(); 2338 } 2339 2340 if(isReallyTouch(e)){ 2341 var touchEvents = getEventsPage(e); 2342 touchStartY = touchEvents.y; 2343 touchStartX = touchEvents.x; 2344 } 2345 } 2346 2347 /** 2348 * Gets the average of the last `number` elements of the given array. 2349 */ 2350 function getAverage(elements, number){
2351 var sum = 0; 2352 2353 //taking `number` elements from the end to make the average, if there are not enought, 1 2354 var lastElements = elements.slice(Math.max(elements.length - number, 1)); 2355 2356 for(var i = 0; i < lastElements.length; i++){ 2357 sum = sum + lastElements[i]; 2358 } 2359 2360 return Math.ceil(sum/number); 2361 } 2362 2363 /** 2364 * Detecting mousewheel scrolling 2365 * 2366 * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html 2367 * http://www.sitepoint.com/html5-javascript-mouse-wheel/ 2368 */ 2369 var prevTime = new Date().getTime(); 2370 2371 function MouseWheelHandler(e) { 2372 2373 2374 var curTime = new Date().getTime(); 2375 var isNormalScroll = $(COMPLETELY_SEL).hasClass(NORMAL_SCROLL); 2376 2377 //autoscrolling and not zooming? 2378 if(options.autoScrolling && !controlPressed && !isNormalScroll){ 2379 // cross-browser wheel delta 2380 e = e || window.event; 2381 var value = e.wheelDelta || -e.deltaY || -e.detail; 2382 var delta = Math.max(-1, Math.min(1, value)); 2383 2384 var horizontalDetection = typeof e.wheelDeltaX !== 'undefined' || typeof e.deltaX !== 'undefined'; 2385 var isScrollingVertically = (Math.abs(e.wheelDeltaX) < Math.abs(e.wheelDelta)) || (Math.abs(e.deltaX ) < Math.abs(e.deltaY) || !horizontalDetection); 2386 2387 //Limiting the array to 150 (lets not waste memory!) 2388 if(scrollings.length > 149){ 2389 scrollings.shift(); 2390 } 2391 2392 //keeping record of the previous scrollings 2393 scrollings.push(Math.abs(value)); 2394 2395 //preventing to scroll the site on mouse wheel when scrollbar is present 2396 if(options.scrollBar){ 2397 e.preventDefault ? e.preventDefault() : e.returnValue = false; 2398 } 2399 2400 var activeSection = $(SECTION_ACTIVE_SEL); 2401 var scrollable = options.scrollOverflowHandler.scrollable(activeSection); 2402 2403 //time difference between the last scroll and the current one 2404 var timeDiff = curTime-prevTime; 2405 prevTime = curTime; 2406 2407 //haven't they scrolled in a while? 2408 //(enough to be consider a different scrolling action to scroll another section) 2409 if(timeDiff > 200){ 2410 //emptying the array, we dont care about old scrollings for our averages 2411 scrollings = []; 2412 } 2413 2414 if(canScroll){ 2415 var averageEnd = getAverage(scrollings, 10); 2416 var averageMiddle = getAverage(scrollings, 70); 2417 var isAccelerating = averageEnd >= averageMiddle; 2418 2419 //to avoid double swipes... 2420 if(isAccelerating && isScrollingVertically && $('.next-current').length == 0){ 2421 //scrolling down? 2422 if (delta < 0) { 2423 scrolling('down', scrollable); 2424 2425 //scrolling up? 2426 }else { 2427 scrolling('up', scrollable); 2428 } 2429 } 2430 } 2431 2432 return false; 2433 } 2434 2435 if(options.fitToSection){ 2436 //stopping the auto scroll to adjust to a section 2437 $htmlBody.stop(); 2438 } 2439 } 2440 2441 /** 2442 * Slides a slider to the given direction. 2443 * Optional `section` param. 2444 */ 2445 function moveSlide(direction, section){ 2446 var activeSection = typeof section === 'undefined' ? $(SECTION_ACTIVE_SEL) : section; 2447 var slides = activeSection.find(SLIDES_WRAPPER_SEL); 2448 var numSlides = slides.find(SLIDE_SEL).length; 2449 2450 // more than one slide needed and nothing should be sliding 2451 if (!slides.length || slideMoving || numSlides < 2) { 2452 return; 2453 } 2454 2455 var currentSlide = slides.find(SLIDE_ACTIVE_SEL); 2456 var destiny = null; 2457 2458 if(direction === 'prev'){ 2459 destiny = currentSlide.prev(SLIDE_SEL); 2460 }else{ 2461 destiny = currentSlide.next(SLIDE_SEL); 2462 } 2463 2464 //isn't there a next slide in the secuence? 2465 if(!destiny.length){ 2466 //respect loopHorizontal settin 2467 if (!options.loopHorizontal) return; 2468 2469 if(direction === 'prev'){ 2470 destiny = currentSlide.siblings(':last'); 2471 }else{ 2472 destiny = currentSlide.siblings(':first'); 2473 } 2474 } 2475 2476 slideMoving = true; 2477
2478 landscapeScroll(slides, destiny); 2479 } 2480 2481 /** 2482 * Maintains the active slides in the viewport 2483 * (Because he `scroll` animation might get lost with some actions, such as when using continuousVertical) 2484 */ 2485 function keepSlidesPosition(){ 2486 $(SLIDE_ACTIVE_SEL).each(function(){ 2487 silentLandscapeScroll($(this), 'internal'); 2488 }); 2489 } 2490 2491 var previousDestTop = 0; 2492 /** 2493 * Returns the destination Y position based on the scrolling direction and 2494 * the height of the section. 2495 */ 2496 function getDestinationPosition(element){ 2497 var elemPosition = element.position(); 2498 2499 //top of the desination will be at the top of the viewport 2500 var position = elemPosition.top; 2501 var isScrollingDown = elemPosition.top > previousDestTop; 2502 var sectionBottom = position - windowsHeight + element.outerHeight(); 2503 2504 //is the destination element bigger than the viewport? 2505 if(element.outerHeight() > windowsHeight){ 2506 //scrolling up? 2507 if(!isScrollingDown){ 2508 position = sectionBottom; 2509 } 2510 } 2511 2512 //sections equal or smaller than the viewport height && scrolling down? || is resizing and its in the last section 2513 else if(isScrollingDown || (isResizing && element.is(':last-child')) ){ 2514 //The bottom of the destination will be at the bottom of the viewport 2515 position = sectionBottom; 2516 } 2517 2518 /* 2519 Keeping record of the last scrolled position to determine the scrolling direction. 2520 No conventional methods can be used as the scroll bar might not be present 2521 AND the section might not be active if it is auto-height and didnt reach the middle 2522 of the viewport. 2523 */ 2524 previousDestTop = position; 2525 return position; 2526 } 2527 2528 /** 2529 * Scrolls the site to the given element and scrolls to the slide if a callback is given. 2530 */ 2531 function scrollPage(element, callback, isMovementUp){ 2532 /* nectar addition of ||canScroll and element.length == 0 */ 2533 if(typeof element === 'undefined' || element.length == 0 || canScroll == false || $('.ocm-effect-wrap.material-ocm-open').length > 0 ){ return; } //there's no element to scroll, leaving the function 2534 2535 var dtop = getDestinationPosition(element); 2536 2537 //local variables 2538 var v = { 2539 element: element, 2540 callback: callback, 2541 isMovementUp: isMovementUp, 2542 dtop: dtop, 2543 yMovement: getYmovement(element), 2544 anchorLink: element.data('anchor'), 2545 sectionIndex: element.index(SECTION_SEL), 2546 activeSlide: element.find(SLIDE_ACTIVE_SEL), 2547 activeSection: $(SECTION_ACTIVE_SEL), 2548 leavingSection: $(SECTION_ACTIVE_SEL).index(SECTION_SEL) + 1, 2549 2550 //caching the value of isResizing at the momment the function is called 2551 //because it will be checked later inside a setTimeout and the value might change 2552 localIsResizing: isResizing 2553 }; 2554 2555 //quiting when destination scroll is the same as the current one 2556 if((v.activeSection.is(element) && !isResizing) || (options.scrollBar && $window.scrollTop() === v.dtop && !element.hasClass(AUTO_HEIGHT) )){ return; } 2557 2558 if(v.activeSlide.length){ 2559 var slideAnchorLink = v.activeSlide.data('anchor'); 2560 var slideIndex = v.activeSlide.index(); 2561 } 2562 2563 // If continuousVertical && we need to wrap around 2564 if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" && 2565 ((!v.isMovementUp && v.yMovement == 'up') || // Intending to scroll down but about to go up or 2566 (v.isMovementUp && v.yMovement == 'down'))) { // intending to scroll up but about to go down 2567 2568 v = createInfiniteSections(v); 2569 } 2570 2571 //callback (onLeave) if the site is not just resizing and readjusting the slides 2572 if($.isFunction(options.onLeave) && !v.localIsResizing){ 2573 if(options.onLeave.call(v.activeSection, v.leavingSection, (v.sectionIndex + 1), v.yMovement) === false){ 2574 return; 2575 } 2576 } 2577 2578 stopMedia(v.activeSection); 2579 /* nectar addition */ 2580 //element.addClass(ACTIVE).siblings().removeClass(ACTIVE); - moved to after section loads location 2581 lazyLoad(element); 2582 options.scrollOverflowHandler.onLeave(); 2583 2584 2585 //preventing from activating the MouseWheelHandler event 2586 //more than once if the page is scrolling 2587 if( !window.vc_iframe) { 2588 canScroll = false; 2589 } 2590 2591 setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex); 2592 2593 performMovement(v); 2594 2595 //flag to avoid callingn `scrollPage()` twice in case of using anchor links 2596 lastScrolledDestiny = v.anchorLink; 2597 2598 //avoid firing it twice (as it does also on scroll) 2599 activateMenuAndNav(v.anchorLink, v.sectionIndex); 2600 } 2601 2602 /** 2603 * Performs the movement (by CSS3 or by jQuery) 2604 */ 2605 function performMovement(v){ 2606 2607 /* nectar addition */ 2608 function switchedSection() { 2609 2610 var current = +new Date(), 2611 remaining = end - current; 2612 2613 if(remaining < 60) { 2614 afterSectionLoads(v); 2615 2616 } else { 2617 requestAnimationFrame(switchedSection); 2618 } 2619 2620 } 2621 2622 scrollings = []; 2623 2624 if($('#nectar_fullscreen_rows[data-animation-speed="medium"]').length > 0) { 2625 var $timeOutDur = ($('.last-before-footer').length == 0) ? 910 : 530; 2626 } 2627 else if($('#nectar_fullscreen_rows[data-animation-speed="slow"]').length > 0) { 2628 var $timeOutDur = ($('.last-before-footer').length == 0) ? 1200 : 530; 2629 } 2630 else { 2631 var $timeOutDur = ($('.last-before-footer').length == 0) ? 720 : 530; 2632 } 2633 2634 // using CSS3 translate functionality 2635 if (options.css3 && !options.scrollBar && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0) { 2636 var translate3d = 'translate3d(0px, -' + v.dtop + 'px, 0px)'; 2637 /* nectar addition */ 2638 //transformContainer(translate3d, true); 2639 2640 //even when the scrollingSpeed is 0 there's a little delay, which might cause the 2641 //scrollingSpeed to change in case of using silentMoveTo(); 2642 if(options.scrollingSpeed){ 2643 afterSectionLoadsId = setTimeout(function () { 2644 afterSectionLoads(v); 2645 HASHCHANGE = false; 2646 }, $timeOutDur); 2647 }else{ 2648 afterSectionLoads(v); 2649 } 2650 } 2651 2652 // using jQuery animate 2653 else{ 2654 2655 2656 var scrollSettings = getScrollSettings(v); 2657 2658 if($('#nectar_fullscreen_rows[data-animation="none"]').length > 0) { 2659 2660 if($('.last-before-footer').length == 0) { 2661 2662 var translate3d = 'translate3d(0px, -' + v.dtop + 'px, 0px)'; 2663 transformContainer(translate3d, true); 2664 2665 //even when the scrollingSpeed is 0 there's a little delay, which might cause the 2666 //scrollingSpeed to change in case of using silentMoveTo(); 2667 if(options.scrollingSpeed){ 2668 2669 if(window.vc_iframe) { 2670 2671 var duration = 950, 2672 end = +new Date() + duration; 2673 var $cur_section = $('#nectar_fullscreen_rows > .active'); 2674 requestAnimationFrame(switchedSection); 2675 2676 } else { 2677 afterSectionLoadsId = setTimeout(function () { 2678 afterSectionLoads(v); 2679 }, options.scrollingSpeed); 2680 } 2681 2682 }else{ 2683 afterSectionLoads(v); 2684 } 2685 2686 2687 } 2688 2689 else { 2690 2691 setTimeout(function(){ 2692 2693 if(options.scrollBar){ 2694 setTimeout(function(){ 2695 afterSectionLoads(v); 2696 },30); 2697 }else{ 2698 afterSectionLoads(v); 2699 } 2700 },$timeOutDur); 2701 } 2702 2703 } 2704 2705 else { 2706 setTimeout(function(){ 2707 2708 if(options.scrollBar){ 2709 setTimeout(function(){ 2710 afterSectionLoads(v); 2711 },30); 2712 }else{ 2713 afterSectionLoads(v); 2714 } 2715 HASHCHANGE = false; 2716 },$timeOutDur); 2717 } 2718 2719 2720 2721 } 2722 } 2723 2724 /** 2725 * Gets the scrolling settings depending on the plugin autoScrolling option 2726 */ 2727 function getScrollSettings(v){ 2728 var scroll = {}; 2729 2730 if(options.autoScrolling && !options.scrollBar){ 2731 scroll.options = { 'top': -v.dtop}; 2732 scroll.element = WRAPPER_SEL; 2733 }else{ 2734 scroll.options = { 'scrollTop': v.dtop}; 2735 scroll.element = 'html, body'; 2736 } 2737 2738 return scroll; 2739 } 2740 2741 /** 2742 * Adds sections before or after the current one to create the infinite effect. 2743 */ 2744 function createInfiniteSections(v){ 2745 // Scrolling down 2746 if (!v.isMovementUp) { 2747 // Move all previous sections to after the active section 2748 $(SECTION_ACTIVE_SEL).after(v.activeSection.prevAll(SECTION_SEL).get().reverse()); 2749 } 2750 else { // Scrolling up 2751 // Move all next sections to before the active section 2752 $(SECTION_ACTIVE_SEL).before(v.activeSection.nextAll(SECTION_SEL)); 2753 } 2754 2755 // Maintain the displayed position (now that we changed the element order) 2756 silentScroll($(SECTION_ACTIVE_SEL).position().top); 2757 2758 // Maintain the active slides visible in the viewport 2759 keepSlidesPosition(); 2760 2761 // save for later the elements that still need to be reordered 2762 v.wrapAroundElements = v.activeSection; 2763 2764 // Recalculate animation variables 2765 v.dtop = v.element.position().top; 2766 v.yMovement = getYmovement(v.element); 2767 2768 return v; 2769 } 2770 2771 /** 2772 * Fix section order after continuousVertical changes have been animated 2773 */ 2774 function continuousVerticalFixSectionOrder (v) {
2775 // If continuousVertical is in effect (and autoScrolling would also be in effect then), 2776 // finish moving the elements around so the direct navigation will function more simply 2777 if (!v.wrapAroundElements || !v.wrapAroundElements.length) { 2778 return; 2779 } 2780 2781 if (v.isMovementUp) { 2782 $(SECTION_FIRST_SEL).before(v.wrapAroundElements); 2783 } 2784 else { 2785 $(SECTION_LAST_SEL).after(v.wrapAroundElements); 2786 } 2787 2788 silentScroll($(SECTION_ACTIVE_SEL).position().top); 2789 2790 // Maintain the active slides visible in the viewport 2791 keepSlidesPosition(); 2792 } 2793 2794 2795 /** 2796 * Actions to do once the section is loaded. 2797 */ 2798 function afterSectionLoads (v){ 2799 2800 continuousVerticalFixSectionOrder(v); 2801 /* nectar addition */ 2802 //v.element.find('.fp-scrollable').mouseover(); 2803 2804 //resizing the scrolling divs 2805 //$(SECTION_SEL).each(function(){ 2806 // if(options.scrollOverflow){ 2807 // createSlimScrolling($(this)); 2808 // } 2809 //}); 2810 2811 $('#nectar_fullscreen_rows').removeClass('trans-animation-active'); 2812 v.element.addClass(ACTIVE).siblings().removeClass(ACTIVE); 2813 2814 //callback (afterLoad) if the site is not just resizing and readjusting the slides 2815 $.isFunction(options.afterLoad) && !v.localIsResizing && options.afterLoad.call(v.element, v.anchorLink, (v.sectionIndex + 1)); 2816 options.scrollOverflowHandler.afterLoad(); 2817 2818 playMedia(v.element); 2819 v.element.addClass(COMPLETELY).siblings().removeClass(COMPLETELY); 2820 2821 $.isFunction(v.callback) && v.callback.call(this); 2822 2823 canScroll = true; 2824 } 2825 2826 /** 2827 * Lazy loads image, video and audio elements. 2828 */ 2829 function lazyLoad(destiny){ 2830 var destiny = getSlideOrSection(destiny); 2831 2832 destiny.find('img[data-src], source[data-src], audio[data-src], iframe[data-src]').each(function(){ 2833 $(this).attr('src', $(this).data('src')); 2834 $(this).removeAttr('data-src'); 2835 2836 if($(this).is('source')){ 2837 $(this).closest('video').get(0).load(); 2838 } 2839 }); 2840 } 2841 2842 /** 2843 * Plays video and audio elements. 2844 */ 2845 function playMedia(destiny){ 2846 2847 /* nectar addition */ 2848 2849 var destiny = getSlideOrSection(destiny); 2850 2851 //playing HTML5 media elements 2852 destiny.find('video.nectar-video-bg').each(function(){ 2853 var element = $(this).get(0); 2854 var videoBGStored = $(this); 2855 2856 if( typeof element.play === 'function' ) { 2857 2858 if( navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) { 2859 element.onplay = function(){ 2860 videoBGStored.parents('.nectar-video-wrap').animate({'opacity':'1'},200); 2861 } 2862 } 2863 2864 element.play(); 2865 2866 } 2867 }); 2868 2869 //youtube videos 2870 destiny.find('.nectar-youtube-bg iframe[src*="youtube.com/embed/"]').each(function(){ 2871 var element = $(this).get(0); 2872 2873 if( /youtube\.com\/embed\//.test($(this).attr('src'))){ 2874 2875 element.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); 2876 } 2877 }); 2878 2879 /* nectar addition end */ 2880 } 2881 2882 /** 2883 * Stops video and audio elements. 2884 */ 2885 function stopMedia(destiny){ 2886 var destiny = getSlideOrSection(destiny); 2887 2888 //stopping HTML5 media elements 2889 destiny.find('video, audio').each(function(){ 2890 var element = $(this).get(0); 2891 2892 if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) { 2893 /* nectar addition */ 2894 //element.pause(); 2895 } 2896 }); 2897 2898 //youtube videos 2899 destiny.find('.nectar-youtube-bg iframe[src*="youtube.com/embed/"]').each(function(){ 2900 var element = $(this).get(0); 2901 2902 if( /youtube\.com\/embed\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){ 2903 $(this).get(0).contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}','*'); 2904 } 2905 }); 2906 } 2907 2908 /** 2909 * Gets the active slide (or section) for the given section 2910 */ 2911 function getSlideOrSection(destiny){ 2912 var slide = destiny.find(SLIDE_ACTIVE_SEL); 2913 if( slide.length ) { 2914 destiny = $(slide); 2915 } 2916 2917 return destiny; 2918 } 2919 2920 /**
2921 * Scrolls to the anchor in the URL when loading the site 2922 */ 2923 function scrollToAnchor(){ 2924 2925 //getting the anchor link in the URL and deleting the `#` 2926 var value = window.location.hash.replace('#', '').split('/'); 2927 var section = decodeURIComponent(value[0]); 2928 var slide = decodeURIComponent(value[1]); 2929 /* nectar addition */ 2930 if(section && $('.vc_row[data-fullscreen-anchor-id="'+section+'"]').length > 0){ //if theres any # 2931 /* nectar addition end */ 2932 if(options.animateAnchor){ 2933 scrollPageAndSlide(section, slide); 2934 }else{ 2935 FP.silentMoveTo(section, slide); 2936 } 2937 } 2938 } 2939 2940 /** 2941 * Detecting any change on the URL to scroll to the given anchor link 2942 * (a way to detect back history button as we play with the hashes on the URL) 2943 */ 2944 function hashChangeHandler(){ 2945 2946 if(!isScrolling && !options.lockAnchors){ 2947 var value = window.location.hash.replace('#', '').split('/'); 2948 var section = decodeURIComponent(value[0]); 2949 var slide = decodeURIComponent(value[1]); 2950 2951 //when moving to a slide in the first section for the first time (first time to add an anchor to the URL) 2952 var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined'); 2953 var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined' && !slideMoving); 2954 2955 2956 if(section.length){ 2957 /*in order to call scrollpage() only once for each destination at a time 2958 It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange` 2959 event is fired on every scroll too.*/ 2960 if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide != slide )) { 2961 scrollPageAndSlide(section, slide); 2962 } 2963 } 2964 2965 2966 } 2967 2968 /* nectar addition */ 2969 2970 //make page history work when clicking faster than transition speed 2971 if($('#nectar_fullscreen_rows[data-animation-speed="medium"]').length > 0) 2972 var $timeOutDur = ($('.last-before-footer').length == 0) ? 900 : 530; 2973 else if($('#nectar_fullscreen_rows[data-animation-speed="slow"]').length > 0) 2974 var $timeOutDur = ($('.last-before-footer').length == 0) ? 1180 : 530; 2975 else 2976 var $timeOutDur = ($('.last-before-footer').length == 0) ? 710 : 530; 2977 2978 if(HASHCHANGE == true) { 2979 clearInterval(HASHCHANGETIMEOUT); 2980 2981 HASHCHANGETIMEOUT = setInterval(function(){ 2982 if(canScroll) { 2983 hashChangeHandler(); 2984 //reset 2985 clearInterval(HASHCHANGETIMEOUT); 2986 } 2987 },100); 2988 } 2989 2990 HASHCHANGE = true; 2991 /* nectar addition */ 2992 } 2993 2994 //Sliding with arrow keys, both, vertical and horizontal 2995 function keydownHandler(e) { 2996 2997 clearTimeout(keydownId); 2998 2999 var activeElement = $(':focus'); 3000 3001 if(!activeElement.is('textarea') && !activeElement.is('input') && !activeElement.is('select') && 3002 activeElement.attr('contentEditable') !== "true" && activeElement.attr('contentEditable') !== '' && 3003 options.keyboardScrolling && options.autoScrolling){ 3004 var keyCode = e.which; 3005 3006 //preventing the scroll with arrow keys & spacebar & Page Up & Down keys 3007 var keyControls = [40, 38, 32, 33, 34]; 3008 if($.inArray(keyCode, keyControls) > -1){ 3009 e.preventDefault(); 3010 } 3011 3012 controlPressed = e.ctrlKey; 3013 3014 keydownId = setTimeout(function(){ 3015 onkeydown(e); 3016 },150); 3017 } 3018 } 3019 3020 function tooltipTextHandler(){ 3021 $(this).prev().trigger('click'); 3022 } 3023 3024 //to prevent scrolling while zooming 3025 function keyUpHandler(e){ 3026 if(isWindowFocused){ //the keyup gets fired on new tab ctrl + t in Firefox 3027 controlPressed = e.ctrlKey; 3028 } 3029 } 3030 3031 //binding the mousemove when the mouse's middle button is released 3032 function mouseDownHandler(e){ 3033 //middle button 3034 if (e.which == 2){ 3035 oldPageY = e.pageY; 3036 container.on('mousemove', mouseMoveHandler); 3037 } 3038 } 3039 3040 //unbinding the mousemove when the mouse's middle button is released 3041 function mouseUpHandler(e){ 3042 //middle button 3043 if (e.which == 2){ 3044 container.off('mousemove'); 3045 } 3046 } 3047 3048 //Scrolling horizontally when clicking on the slider controls. 3049 function slideArrowHandler(){ 3050 var section = $(this).closest(SECTION_SEL); 3051 3052 if ($(this).hasClass(SLIDES_PREV)) { 3053 if(isScrollAllowed.m.left){ 3054 FP.moveSlideLeft(section); 3055 } 3056 } else { 3057 if(isScrollAllowed.m.right){ 3058 FP.moveSlideRight(section); 3059 } 3060 } 3061 } 3062 3063 //when opening a new tab (ctrl + t), `control` won't be pressed when comming back. 3064 function blurHandler(){ 3065 isWindowFocused = false; 3066 controlPressed = false; 3067 } 3068 3069 //Scrolls to the section when clicking the navigation bullet 3070 function sectionBulletHandler(e){ 3071 e.preventDefault(); 3072 /* nectar addition */ 3073 if($('#nectar_fullscreen_rows .wpb_row.transition-out').length == 0) { 3074 var index = $(this).parent().index(); 3075 scrollPage($(SECTION_SEL).eq(index)); 3076 } 3077 } 3078 3079 //Scrolls the slider to the given slide destination for the given section 3080 function slideBulletHandler(e){ 3081 e.preventDefault(); 3082 var slides = $(this).closest(SECTION_SEL).find(SLIDES_WRAPPER_SEL); 3083 var destiny = slides.find(SLIDE_SEL).eq($(this).closest('li').index()); 3084
3085 landscapeScroll(slides, destiny); 3086 } 3087 3088 /** 3089 * Keydown event 3090 */ 3091 function onkeydown(e){ 3092 var shiftPressed = e.shiftKey; 3093 3094 switch (e.which) { 3095 //up 3096 case 38: 3097 case 33: 3098 if(isScrollAllowed.k.up){ 3099 FP.moveSectionUp(); 3100 } 3101 break; 3102 3103 //down 3104 case 32: //spacebar 3105 if(shiftPressed && isScrollAllowed.k.up){ 3106 FP.moveSectionUp(); 3107 break; 3108 } 3109 case 40: 3110 case 34: 3111 if(isScrollAllowed.k.down){ 3112 FP.moveSectionDown(); 3113 } 3114 break; 3115 3116 //Home 3117 case 36: 3118 if(isScrollAllowed.k.up){ 3119 FP.moveTo(1); 3120 } 3121 break; 3122 3123 //End 3124 case 35: 3125 if(isScrollAllowed.k.down){ 3126 FP.moveTo( $(SECTION_SEL).length ); 3127 } 3128 break; 3129 3130 //left 3131 case 37: 3132 if(isScrollAllowed.k.left){ 3133 FP.moveSlideLeft(); 3134 } 3135 break; 3136 3137 //right 3138 case 39: 3139 if(isScrollAllowed.k.right){ 3140 FP.moveSlideRight(); 3141 } 3142 break; 3143 3144 default: 3145 return; // exit this handler for other keys 3146 } 3147 } 3148 3149 /** 3150 * Detecting the direction of the mouse movement. 3151 * Used only for the middle button of the mouse. 3152 */ 3153 var oldPageY = 0; 3154 function mouseMoveHandler(e){ 3155 if(canScroll){ 3156 // moving up 3157 if (e.pageY < oldPageY && isScrollAllowed.m.up){ 3158 FP.moveSectionUp(); 3159 } 3160 3161 // moving down 3162 else if(e.pageY > oldPageY && isScrollAllowed.m.down){ 3163 FP.moveSectionDown(); 3164 } 3165 } 3166 oldPageY = e.pageY; 3167 } 3168 3169 /** 3170 * Scrolls horizontal sliders. 3171 */ 3172 function landscapeScroll(slides, destiny){ 3173 var destinyPos = destiny.position(); 3174 var slideIndex = destiny.index(); 3175 var section = slides.closest(SECTION_SEL); 3176 var sectionIndex = section.index(SECTION_SEL); 3177 var anchorLink = section.data('anchor'); 3178 var slidesNav = section.find(SLIDES_NAV_SEL); 3179 var slideAnchor = getAnchor(destiny); 3180 var prevSlide = section.find(SLIDE_ACTIVE_SEL); 3181 3182 //caching the value of isResizing at the momment the function is called 3183 //because it will be checked later inside a setTimeout and the value might change 3184 var localIsResizing = isResizing; 3185 3186 if(options.onSlideLeave){ 3187 var prevSlideIndex = prevSlide.index(); 3188 var xMovement = getXmovement(prevSlideIndex, slideIndex); 3189 3190 //if the site is not just resizing and readjusting the slides 3191 if(!localIsResizing && xMovement!=='none'){ 3192 if($.isFunction( options.onSlideLeave )){ 3193 if(options.onSlideLeave.call( prevSlide, anchorLink, (sectionIndex + 1), prevSlideIndex, xMovement, slideIndex ) === false){ 3194 slideMoving = false; 3195 return; 3196 } 3197 } 3198 } 3199 } 3200 stopMedia(prevSlide); 3201 3202 destiny.addClass(ACTIVE).siblings().removeClass(ACTIVE); 3203 if(!localIsResizing){ 3204 lazyLoad(destiny); 3205 } 3206 3207 if(!options.loopHorizontal && options.controlArrows){ 3208 //hidding it for the fist slide, showing for the rest 3209 section.find(SLIDES_ARROW_PREV_SEL).toggle(slideIndex!==0); 3210 3211 //hidding it for the last slide, showing for the rest 3212 section.find(SLIDES_ARROW_NEXT_SEL).toggle(!destiny.is(':last-child')); 3213 } 3214 3215 //only changing the URL if the slides are in the current section (not for resize re-adjusting) 3216 if(section.hasClass(ACTIVE)){ 3217 setState(slideIndex, slideAnchor, anchorLink, sectionIndex); 3218 } 3219 3220 var afterSlideLoads = function(){ 3221 //if the site is not just resizing and readjusting the slides 3222 if(!localIsResizing){ 3223 $.isFunction( options.afterSlideLoad ) && options.afterSlideLoad.call( destiny, anchorLink, (sectionIndex + 1), slideAnchor, slideIndex); 3224 } 3225 playMedia(destiny); 3226 3227 //letting them slide again 3228 slideMoving = false; 3229 }; 3230 3231 if(options.css3){ 3232 var translate3d = 'translate3d(-' + Math.round(destinyPos.left) + 'px, 0px, 0px)'; 3233 3234 addAnimation(slides.find(SLIDES_CONTAINER_SEL), options.scrollingSpeed>0).css(getTransforms(translate3d)); 3235 3236 afterSlideLoadsId = setTimeout(function(){ 3237 afterSlideLoads(); 3238 }, options.scrollingSpeed, options.easing); 3239 }else{ 3240 slides.animate({ 3241 scrollLeft : Math.round(destinyPos.left) 3242 }, options.scrollingSpeed, options.easing, function() { 3243 3244 afterSlideLoads(); 3245 }); 3246 } 3247 3248 slidesNav.find(ACTIVE_SEL).removeClass(ACTIVE); 3249 slidesNav.find('li').eq(slideIndex).find('a').addClass(ACTIVE); 3250 } 3251 3252 var previousHeight = windowsHeight; 3253 3254 //when resizing the site, we adjust the heights of the sections, slimScroll... 3255 function resizeHandler(){ 3256 if($('#nectar_fullscreen_rows.afterLoaded').length == 0) return false; 3257 //checking if it needs to get responsive 3258 responsive(); 3259 3260 // rebuild immediately on touch devices 3261 if (isTouchDevice) { 3262 var activeElement = $(document.activeElement); 3263 3264 //if the keyboard is NOT visible 3265 if (!activeElement.is('textarea') && !activeElement.is('input') && !activeElement.is('select')) { 3266 var currentHeight = $window.height(); 3267 3268 //making sure the change in the viewport size is enough to force a rebuild. (20 % of the window to avoid problems when hidding scroll bars) 3269 /* nectar addition */ 3270 //if( Math.abs(currentHeight - previousHeight) > (20 * Math.max(previousHeight, currentHeight) / 100) ){ 3271 FP.reBuild(true); 3272 previousHeight = currentHeight; 3273 //} 3274 /* nectar addition end */ 3275 } 3276 }else{ 3277 //in order to call the functions only when the resize is finished 3278 //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing 3279 clearTimeout(resizeId); 3280 3281 /* nectar addition */ 3282 // resizeId = setTimeout(function(){ 3283 FP.reBuild(true); 3284 // }, 230); 3285 } 3286 } 3287 /* nectar addition */ 3288 function checkScrollOverflow() { 3289 if($('#nectar_fullscreen_rows.afterLoaded').length ==0) return false; 3290 $(SECTION_SEL).each(function(){ 3291 3292 //resizing the scrolling divs 3293 if(options.scrollOverflow){ 3294 3295 createSlimScrolling($(this)); 3296 3297 } 3298 3299 }); 3300 } 3301 /** 3302 * Checks if the site needs to get responsive and disables autoScrolling if so. 3303 * A class `fp-responsive` is added to the plugin's container in case the user wants to use it for his own responsive CSS. 3304 */ 3305 function responsive(){ 3306 var widthLimit = options.responsive || options.responsiveWidth; //backwards compatiblity 3307 var heightLimit = options.responsiveHeight; 3308 3309 //only calculating what we need. Remember its called on the resize event. 3310 var isBreakingPointWidth = widthLimit && $window.outerWidth() < widthLimit; 3311 var isBreakingPointHeight = heightLimit && $window.height() < heightLimit; 3312 3313 if(widthLimit && heightLimit){ 3314 FP.setResponsive(isBreakingPointWidth || isBreakingPointHeight); 3315 } 3316 else if(widthLimit){ 3317 FP.setResponsive(isBreakingPointWidth);
3318 } 3319 else if(heightLimit){ 3320 FP.setResponsive(isBreakingPointHeight); 3321 } 3322 3323 /* nectar addition */ 3324 $(SECTION_NAV_SEL).css('margin-top', '-' + (($(SECTION_NAV_SEL).height()/2) - $adminBar - $headerHeight/2) + 'px'); 3325 } 3326 3327 /** 3328 * Adds transition animations for the given element 3329 */ 3330 function addAnimation(element){ 3331 var transition = 'all ' + options.scrollingSpeed + 'ms ' + options.easingcss3; 3332 3333 element.removeClass(NO_TRANSITION); 3334 return element.css({ 3335 '-webkit-transition': transition, 3336 'transition': transition 3337 }); 3338 } 3339 3340 /** 3341 * Remove transition animations for the given element 3342 */ 3343 function removeAnimation(element){ 3344 return element.addClass(NO_TRANSITION); 3345 } 3346 3347 /** 3348 * Activating the website navigation dots according to the given slide name. 3349 */ 3350 function activateNavDots(name, sectionIndex){ 3351 if(options.navigation){ 3352 $(SECTION_NAV_SEL).find(ACTIVE_SEL).removeClass(ACTIVE); 3353 if(name){ 3354 $(SECTION_NAV_SEL).find('a[href="#' + name + '"]').addClass(ACTIVE); 3355 }else{ 3356 $(SECTION_NAV_SEL).find('li').eq(sectionIndex).find('a').addClass(ACTIVE); 3357 } 3358 } 3359 } 3360 3361 /** 3362 * Activating the website main menu elements according to the given slide name. 3363 */ 3364 function activateMenuElement(name){ 3365 if(options.menu){ 3366 $(options.menu).find(ACTIVE_SEL).removeClass(ACTIVE); 3367 $(options.menu).find('[data-menuanchor="'+name+'"]').addClass(ACTIVE); 3368 } 3369 } 3370 3371 /** 3372 * Sets to active the current menu and vertical nav items. 3373 */ 3374 function activateMenuAndNav(anchor, index){ 3375 activateMenuElement(anchor); 3376 activateNavDots(anchor, index); 3377 } 3378 3379 /** 3380 * Retuns `up` or `down` depending on the scrolling movement to reach its destination 3381 * from the current section. 3382 */ 3383 function getYmovement(destiny){ 3384 var fromIndex = $(SECTION_ACTIVE_SEL).index(SECTION_SEL); 3385 var toIndex = destiny.index(SECTION_SEL); 3386 if( fromIndex == toIndex){ 3387 return 'none'; 3388 } 3389 if(fromIndex > toIndex){ 3390 return 'up'; 3391 } 3392 return 'down'; 3393 } 3394 3395 /** 3396 * Retuns `right` or `left` depending on the scrolling movement to reach its destination 3397 * from the current slide. 3398 */ 3399 function getXmovement(fromIndex, toIndex){ 3400 if( fromIndex == toIndex){ 3401 return 'none'; 3402 } 3403 if(fromIndex > toIndex){ 3404 return 'left'; 3405 } 3406 return 'right'; 3407 } 3408 3409 /** 3410 * Checks if the element needs scrollbar and if the user wants to apply it. 3411 * If so it creates it. 3412 * 3413 * @param {Object} element jQuery object of the section or slide 3414 */ 3415 function createSlimScrolling(element){ 3416 3417 var $fpScrollOverflow = ($('#nectar_fullscreen_rows').attr('data-content-overflow') == 'hidden') ? false : true; 3418 3419 //User doesn't want scrollbar here? Sayonara baby! 3420 if(element.hasClass('fp-noscroll')) return; 3421 3422 //needed to make `scrollHeight` work under Opera 12 3423 element.css('overflow', 'hidden'); 3424 3425 var scrollOverflowHandler = options.scrollOverflowHandler; 3426 var wrap = scrollOverflowHandler.wrapContent(); 3427 //in case element is a slide 3428 var section = element.closest(SECTION_SEL); 3429 var scrollable = scrollOverflowHandler.scrollable(element); 3430 var contentHeight; 3431 3432 //if there was scroll, the contentHeight will be the one in the scrollable section 3433 if(scrollable.length){ 3434 /* nectar addition */ 3435 //contentHeight = scrollOverflowHandler.scrollHeight(element); 3436 contentHeight = ( element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').length > 0 ) ? element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').outerHeight(true) : element.find('.full-page-inner-wrap > .full-page-inner > .span_12').outerHeight(true); 3437 /* nectar addition end */ 3438 } else{ 3439 /* nectar addition */ 3440 contentHeight = ( element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').length > 0 ) ? element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').outerHeight(true) : element.find('.full-page-inner-wrap > .full-page-inner > .span_12').outerHeight(true); 3441 if(options.verticalCentered){ 3442 contentHeight = ( element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').length > 0 ) ? element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').outerHeight(true) : element.find('.full-page-inner-wrap > .full-page-inner > .span_12').outerHeight(true); 3443 } 3444 } 3445 3446 /* nectar addition */ 3447 var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight(); 3448 var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar 3449 if(window.vc_iframe) { $adminBar = 0; } 3450 var $headerHeight = ($('#header-outer.transparent').length == 0 ) ? $headerNavSpace : 0 ; 3451 if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) { 3452 $headerHeight += $('#header-secondary-outer').height(); 3453 } 3454 var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2; 3455 var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0; 3456 var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap 3457 3458 windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra; 3459 var scrollHeight = windowsHeight - parseInt(section.css('padding-bottom')) - parseInt(section.css('padding-top')); 3460 3461 //needs scroll? 3462 if ( contentHeight > windowsHeight+5 && $(element).find('.nectar-slider-wrap[data-fullscreen="true"]').length == 0 && !($(window).width() > 1000 && $fpScrollOverflow == false) ) { 3463 3464 3465 //was there already an scroll ? Updating it 3466 if(scrollable.length){ 3467 scrollOverflowHandler.update(element, scrollHeight); 3468 } 3469 //creating the scrolling 3470 else{ 3471 3472 if(options.verticalCentered){ 3473 element.find(TABLE_CELL_SEL).wrapInner(wrap); 3474 }else{ 3475 element.wrapInner(wrap); 3476 } 3477 scrollOverflowHandler.create(element, scrollHeight); 3478 } 3479 } 3480 //removing the scrolling when it is not necessary anymore 3481 else{ 3482 scrollOverflowHandler.remove(element); 3483 } 3484 3485 //undo 3486 element.css('overflow', ''); 3487 } 3488 3489 function addTableClass(element){ 3490 /*nectar addition - front end editor*/ 3491 if(window.vc_iframe) { 3492 element.addClass(TABLE).find('> .wpb_row').wrapInner('<div class="' + TABLE_CELL + '" style="height:' + getTableHeight(element) + 'px;" />'); 3493 } else { 3494 element.addClass(TABLE).wrapInner('<div class="' + TABLE_CELL + '" style="height:' + getTableHeight(element) + 'px;" />'); 3495 } 3496 } 3497 3498 function getTableHeight(element){ 3499 var sectionHeight = windowsHeight; 3500 3501 if(options.paddingTop || options.paddingBottom){ 3502 var section = element; 3503 if(!section.hasClass(SECTION)){ 3504 section = element.closest(SECTION_SEL); 3505 } 3506 3507 var paddings = parseInt(section.css('padding-top')) + parseInt(section.css('padding-bottom')); 3508 sectionHeight = (windowsHeight - paddings); 3509 } 3510 3511 return sectionHeight; 3512 } 3513 3514 /** 3515 * Adds a css3 transform property to the container class with or without animation depending on the animated param. 3516 */ 3517 function transformContainer(translate3d, animated){ 3518 if(animated){ 3519 addAnimation(container); 3520 }else{ 3521 removeAnimation(container); 3522 } 3523 3524 container.css(getTransforms(translate3d)); 3525 3526 //syncronously removing the class after the animation has been applied. 3527 setTimeout(function(){ 3528 container.removeClass(NO_TRANSITION); 3529 },10); 3530 } 3531 3532 /** 3533 * Gets a section by its anchor / index 3534 */ 3535 function getSectionByAnchor(sectionAnchor){ 3536 //section 3537 var section = container.find(SECTION_SEL + '[data-anchor="'+sectionAnchor+'"]'); 3538 if(!section.length){ 3539 section = $(SECTION_SEL).eq( (sectionAnchor -1) ); 3540 } 3541 3542 return section; 3543 } 3544 3545 /** 3546 * Gets a slide inside a given section by its anchor / index 3547 */ 3548 function getSlideByAnchor(slideAnchor, section){ 3549 var slides = section.find(SLIDES_WRAPPER_SEL); 3550 var slide = slides.find(SLIDE_SEL + '[data-anchor="'+slideAnchor+'"]'); 3551
3552 if(!slide.length){ 3553 slide = slides.find(SLIDE_SEL).eq(slideAnchor); 3554 } 3555 3556 return slide; 3557 } 3558 3559 /** 3560 * Scrolls to the given section and slide anchors 3561 */ 3562 function scrollPageAndSlide(destiny, slide){ 3563 var section = getSectionByAnchor(destiny); 3564 3565 //default slide 3566 if (typeof slide === 'undefined') { 3567 slide = 0; 3568 } 3569 3570 //we need to scroll to the section and then to the slide 3571 if (destiny !== lastScrolledDestiny && !section.hasClass(ACTIVE)){ 3572 scrollPage(section, function(){ 3573 scrollSlider(section, slide); 3574 }); 3575 } 3576 //if we were already in the section 3577 else{ 3578 scrollSlider(section, slide); 3579 } 3580 } 3581 3582 /** 3583 * Scrolls the slider to the given slide destination for the given section 3584 */ 3585 function scrollSlider(section, slideAnchor){ 3586 if(typeof slideAnchor !== 'undefined'){ 3587 var slides = section.find(SLIDES_WRAPPER_SEL); 3588 var destiny = getSlideByAnchor(slideAnchor, section); 3589 3590 if(destiny.length){ 3591 landscapeScroll(slides, destiny); 3592 } 3593 } 3594 } 3595 3596 /** 3597 * Creates a landscape navigation bar with dots for horizontal sliders. 3598 */ 3599 function addSlidesNavigation(section, numSlides){ 3600 section.append('<div class="' + SLIDES_NAV + '"><ul></ul></div>'); 3601 var nav = section.find(SLIDES_NAV_SEL); 3602 3603 //top or bottom 3604 nav.addClass(options.slidesNavPosition); 3605 3606 for(var i=0; i< numSlides; i++){ 3607 nav.find('ul').append('<li><a href="#"><span></span></a></li>'); 3608 } 3609 3610 //centering it 3611 nav.css('margin-left', '-' + (nav.width()/2) + 'px'); 3612 3613 nav.find('li').first().find('a').addClass(ACTIVE); 3614 } 3615 3616 3617 /** 3618 * Sets the state of the website depending on the active section/slide. 3619 * It changes the URL hash when needed and updates the body class. 3620 */ 3621 function setState(slideIndex, slideAnchor, anchorLink, sectionIndex){ 3622 var sectionHash = ''; 3623 3624 if(options.anchors.length && !options.lockAnchors){ 3625 3626 //isn't it the first slide? 3627 if(slideIndex){ 3628 if(typeof anchorLink !== 'undefined'){ 3629 sectionHash = anchorLink; 3630 } 3631 3632 //slide without anchor link? We take the index instead. 3633 if(typeof slideAnchor === 'undefined'){ 3634 slideAnchor = slideIndex; 3635 } 3636 3637 lastScrolledSlide = slideAnchor; 3638 setUrlHash(sectionHash + '/' + slideAnchor); 3639 3640 //first slide won't have slide anchor, just the section one 3641 }else if(typeof slideIndex !== 'undefined'){ 3642 lastScrolledSlide = slideAnchor; 3643 setUrlHash(anchorLink); 3644 } 3645 3646 //section without slides 3647 else{ 3648 setUrlHash(anchorLink); 3649 } 3650 } 3651 3652 setBodyClass(); 3653 } 3654 3655 /** 3656 * Sets the URL hash. 3657 */ 3658 function setUrlHash(url){ 3659 if(options.recordHistory){ 3660 location.hash = url; 3661 }else{ 3662 //Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :) 3663 if(isTouchDevice || isTouch){ 3664 window.history.replaceState(undefined, undefined, '#' + url); 3665 }else{ 3666 var baseUrl = window.location.href.split('#')[0]; 3667 window.location.replace( baseUrl + '#' + url ); 3668 } 3669 } 3670 } 3671 3672 /**
3673 * Gets the anchor for the given slide / section. Its index will be used if there's none. 3674 */ 3675 function getAnchor(element){ 3676 var anchor = element.data('anchor'); 3677 var index = element.index(); 3678 3679 //Slide without anchor link? We take the index instead. 3680 if(typeof anchor === 'undefined'){ 3681 anchor = index; 3682 } 3683 3684 return anchor; 3685 } 3686 3687 /** 3688 * Sets a class for the body of the page depending on the active section / slide 3689 */ 3690 function setBodyClass(){ 3691 /* nectar addition */ 3692 /* 3693 var section = $(SECTION_ACTIVE_SEL); 3694 var slide = section.find(SLIDE_ACTIVE_SEL); 3695 3696 var sectionAnchor = getAnchor(section); 3697 var slideAnchor = getAnchor(slide); 3698 3699 var text = String(sectionAnchor); 3700 3701 if(slide.length){ 3702 text = text + '-' + slideAnchor; 3703 } 3704 3705 //changing slash for dash to make it a valid CSS style 3706 text = text.replace('/', '-').replace('#',''); 3707 3708 //removing previous anchor classes 3709 var classRe = new RegExp('\\b\\s?' + VIEWING_PREFIX + '-[^\\s]+\\b', "g"); 3710 $body[0].className = $body[0].className.replace(classRe, ''); 3711 3712 //adding the current anchor 3713 $body.addClass(VIEWING_PREFIX + '-' + text); 3714 */ 3715 } 3716 3717 /** 3718 * Checks for translate3d support 3719 * @return boolean 3720 * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support 3721 */ 3722 function support3d() { 3723 var el = document.createElement('p'), 3724 has3d, 3725 transforms = { 3726 'webkitTransform':'-webkit-transform',
3727 'OTransform':'-o-transform', 3728 'msTransform':'-ms-transform', 3729 'MozTransform':'-moz-transform', 3730 'transform':'transform' 3731 }; 3732 3733 // Add it to the body to get the computed style. 3734 document.body.insertBefore(el, null); 3735 3736 for (var t in transforms) { 3737 if (el.style[t] !== undefined) { 3738 el.style[t] = 'translate3d(1px,1px,1px)'; 3739 has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]); 3740 } 3741 } 3742 3743 document.body.removeChild(el); 3744 3745 return (has3d !== undefined && has3d.length > 0 && has3d !== 'none'); 3746 } 3747 3748 /** 3749 * Removes the auto scrolling action fired by the mouse wheel and trackpad. 3750 * After this function is called, the mousewheel and trackpad movements won't scroll through sections. 3751 */ 3752 function removeMouseWheelHandler(){ 3753 if (document.addEventListener) { 3754 document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper 3755 document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox 3756 document.removeEventListener('MozMousePixelScroll', MouseWheelHandler, false); //old Firefox 3757 } else { 3758 document.detachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8 3759 } 3760 } 3761 3762 /** 3763 * Adds the auto scrolling action for the mouse wheel and trackpad. 3764 * After this function is called, the mousewheel and trackpad movements will scroll through sections 3765 * https://developer.mozilla.org/en-US/docs/Web/Events/wheel 3766 */ 3767 function addMouseWheelHandler(){ 3768 var prefix = ''; 3769 var _addEventListener; 3770 3771 if (window.addEventListener){ 3772 _addEventListener = "addEventListener"; 3773 }else{ 3774 _addEventListener = "attachEvent"; 3775 prefix = 'on'; 3776 } 3777 3778 // detect available wheel event 3779 var support = 'onwheel' in document.createElement('div') ? 'wheel' : // Modern browsers support "wheel" 3780 document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least "mousewheel" 3781 'DOMMouseScroll'; // let's assume that remaining browsers are older Firefox 3782 3783 3784 if(support == 'DOMMouseScroll'){ 3785 document[ _addEventListener ](prefix + 'MozMousePixelScroll', MouseWheelHandler, false); 3786 } 3787 3788 //handle MozMousePixelScroll in older Firefox 3789 else{ 3790 document[ _addEventListener ](prefix + support, MouseWheelHandler, false); 3791 } 3792 } 3793 3794 /** 3795 * Binding the mousemove when the mouse's middle button is pressed 3796 */ 3797 function addMiddleWheelHandler(){ 3798 container 3799 .on('mousedown', mouseDownHandler) 3800 .on('mouseup', mouseUpHandler); 3801 } 3802 3803 /** 3804 * Unbinding the mousemove when the mouse's middle button is released 3805 */ 3806 function removeMiddleWheelHandler(){ 3807 container 3808 .off('mousedown', mouseDownHandler) 3809 .off('mouseup', mouseUpHandler); 3810 } 3811 3812 /** 3813 * Adds the possibility to auto scroll through sections on touch devices. 3814 */ 3815 function addTouchHandler(){ 3816 if(isTouchDevice || isTouch){ 3817 //Microsoft pointers 3818 var MSPointer = getMSPointer(); 3819 3820 $(WRAPPER_SEL).off('touchstart ' + MSPointer.down).on('touchstart ' + MSPointer.down, touchStartHandler); 3821 $(WRAPPER_SEL).off('touchmove ' + MSPointer.move).on('touchmove ' + MSPointer.move, touchMoveHandler); 3822 } 3823 } 3824 3825 /** 3826 * Removes the auto scrolling for touch devices. 3827 */ 3828 function removeTouchHandler(){ 3829 if(isTouchDevice || isTouch){ 3830 //Microsoft pointers 3831 var MSPointer = getMSPointer(); 3832 3833 $(WRAPPER_SEL).off('touchstart ' + MSPointer.down);
3834 $(WRAPPER_SEL).off('touchmove ' + MSPointer.move); 3835 } 3836 } 3837 3838 /* 3839 * Returns and object with Microsoft pointers (for IE<11 and for IE >= 11) 3840 * http://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx 3841 */ 3842 function getMSPointer(){ 3843 var pointer; 3844 3845 //IE >= 11 & rest of browsers 3846 if(window.PointerEvent){ 3847 pointer = { down: 'pointerdown', move: 'pointermove'}; 3848 } 3849 3850 //IE < 11 3851 else{ 3852 pointer = { down: 'MSPointerDown', move: 'MSPointerMove'}; 3853 } 3854 3855 return pointer; 3856 } 3857 3858 /** 3859 * Gets the pageX and pageY properties depending on the browser. 3860 * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854 3861 */ 3862 function getEventsPage(e){ 3863 var events = []; 3864 3865 events.y = (typeof e.pageY !== 'undefined' && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY); 3866 events.x = (typeof e.pageX !== 'undefined' && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX); 3867 3868 //in touch devices with scrollBar:true, e.pageY is detected, but we have to deal with touch events. #1008 3869 if(isTouch && isReallyTouch(e) && options.scrollBar){ 3870 events.y = e.touches[0].pageY; 3871 events.x = e.touches[0].pageX; 3872 } 3873 3874 return events; 3875 } 3876 3877 /** 3878 * Slides silently (with no animation) the active slider to the given slide. 3879 */ 3880 function silentLandscapeScroll(activeSlide, noCallbacks){ 3881 FP.setScrollingSpeed (0, 'internal'); 3882 3883 if(typeof noCallbacks !== 'undefined'){ 3884 //preventing firing callbacks afterSlideLoad etc. 3885 isResizing = true; 3886 } 3887 3888 landscapeScroll(activeSlide.closest(SLIDES_WRAPPER_SEL), activeSlide); 3889 3890 if(typeof noCallbacks !== 'undefined'){ 3891 isResizing = false; 3892 } 3893 3894 FP.setScrollingSpeed(originals.scrollingSpeed, 'internal'); 3895 } 3896 3897 /** 3898 * Scrolls silently (with no animation) the page to the given Y position. 3899 */ 3900 function silentScroll(top){ 3901 if(options.scrollBar){ 3902 container.scrollTop(top); 3903 } 3904 else if (options.css3) { 3905 var translate3d = 'translate3d(0px, -' + top + 'px, 0px)'; 3906 transformContainer(translate3d, false); 3907 } 3908 else { 3909 container.css('top', -top); 3910 } 3911 } 3912 3913 /** 3914 * Returns the cross-browser transform string. 3915 */ 3916 function getTransforms(translate3d){ 3917 return { 3918 '-webkit-transform': translate3d, 3919 '-moz-transform': translate3d, 3920 '-ms-transform':translate3d, 3921 'transform': translate3d 3922 }; 3923 } 3924 3925 /** 3926 * Allowing or disallowing the mouse/swipe scroll in a given direction. (not for keyboard) 3927 * @type m (mouse) or k (keyboard) 3928 */ 3929 function setIsScrollAllowed(value, direction, type){ 3930 switch (direction){ 3931 case 'up': isScrollAllowed[type].up = value; break; 3932 case 'down': isScrollAllowed[type].down = value; break; 3933 case 'left': isScrollAllowed[type].left = value; break; 3934 case 'right': isScrollAllowed[type].right = value; break; 3935 case 'all': 3936 if(type == 'm'){ 3937 FP.setAllowScrolling(value); 3938 }else{ 3939 FP.setKeyboardScrolling(value); 3940 } 3941 } 3942 } 3943 3944 /* 3945 * Destroys fullpage.js plugin events and optinally its html markup and styles 3946 */ 3947 FP.destroy = function(all){ 3948 FP.setAutoScrolling(false, 'internal'); 3949 FP.setAllowScrolling(false); 3950 FP.setKeyboardScrolling(false); 3951 container.addClass(DESTROYED); 3952 3953 clearTimeout(afterSlideLoadsId); 3954 clearTimeout(afterSectionLoadsId); 3955 clearTimeout(resizeId); 3956 clearTimeout(scrollId); 3957 clearTimeout(scrollId2); 3958 3959 $window 3960 .off('scroll', scrollHandler) 3961 .off('hashchange', hashChangeHandler) 3962 .off('resize', resizeHandler); 3963 3964 $document 3965 .off('click', SECTION_NAV_SEL + ' a') 3966 .off('mouseenter', SECTION_NAV_SEL + ' li') 3967 .off('mouseleave', SECTION_NAV_SEL + ' li') 3968 .off('click', SLIDES_NAV_LINK_SEL) 3969 .off('mouseover', options.normalScrollElements) 3970 .off('mouseout', options.normalScrollElements); 3971 3972 $(SECTION_SEL) 3973 .off('click', SLIDES_ARROW_SEL);
3974 3975 clearTimeout(afterSlideLoadsId); 3976 clearTimeout(afterSectionLoadsId); 3977 3978 //lets make a mess! 3979 if(all){ 3980 destroyStructure(); 3981 } 3982 }; 3983 3984 /* 3985 * Removes inline styles added by fullpage.js 3986 */ 3987 function destroyStructure(){ 3988 //reseting the `top` or `translate` properties to 0 3989 silentScroll(0); 3990 3991 $(SECTION_NAV_SEL + ', ' + SLIDES_NAV_SEL + ', ' + SLIDES_ARROW_SEL).remove(); 3992 3993 //removing inline styles 3994 $(SECTION_SEL).css( { 3995 'height': '', 3996 'background-color' : '', 3997 'padding': '' 3998 }); 3999 4000 $(SLIDE_SEL).css( { 4001 'width': '' 4002 }); 4003 4004 container.css({ 4005 'height': '', 4006 'position': '', 4007 '-ms-touch-action': '', 4008 'touch-action': '' 4009 }); 4010 4011 $htmlBody.css({ 4012 'overflow': '', 4013 'height': '' 4014 }); 4015 4016 // remove .fp-enabled class 4017 $('html').removeClass(ENABLED); 4018 4019 // remove all of the .fp-viewing- classes 4020 $.each($body.get(0).className.split(/\s+/), function (index, className) { 4021 if (className.indexOf(VIEWING_PREFIX) === 0) { 4022 $body.removeClass(className); 4023 } 4024 }); 4025 4026 //removing added classes 4027 $(SECTION_SEL + ', ' + SLIDE_SEL).each(function(){ 4028 options.scrollOverflowHandler.remove($(this)); 4029 $(this).removeClass(TABLE + ' ' + ACTIVE); 4030 }); 4031 4032 removeAnimation(container); 4033 4034 //Unwrapping content 4035 container.find(TABLE_CELL_SEL + ', ' + SLIDES_CONTAINER_SEL + ', ' + SLIDES_WRAPPER_SEL).each(function(){ 4036 //unwrap not being use in case there's no child element inside and its just text 4037 $(this).replaceWith(this.childNodes); 4038 }); 4039 4040 //scrolling the page to the top with no animation 4041 $htmlBody.scrollTop(0); 4042 4043 //removing selectors 4044 var usedSelectors = [SECTION, SLIDE, SLIDES_CONTAINER]; 4045 $.each(usedSelectors, function(index, value){ 4046 $('.' + value).removeClass(value); 4047 }); 4048 } 4049 4050 /* 4051 * Sets the state for a variable with multiple states (original, and temporal) 4052 * Some variables such as `autoScrolling` or `recordHistory` might change automatically its state when using `responsive` or `autoScrolling:false`. 4053 * This function is used to keep track of both states, the original and the temporal one. 4054 * If type is not 'internal', then we assume the user is globally changing the variable. 4055 */ 4056 function setVariableState(variable, value, type){ 4057 options[variable] = value; 4058 if(type !== 'internal'){ 4059 originals[variable] = value; 4060 } 4061 } 4062 4063 /** 4064 * Displays warnings 4065 */ 4066 function displayWarnings(){ 4067 if($('html').hasClass(ENABLED)){ 4068 showError('error', 'Fullpage.js can only be initialized once and you are doing it multiple times!'); 4069 return; 4070 } 4071 4072 // Disable mutually exclusive settings 4073 if (options.continuousVertical && 4074 (options.loopTop || options.loopBottom)) { 4075 options.continuousVertical = false; 4076 showError('warn', 'Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); 4077 } 4078 4079 if(options.scrollBar && options.scrollOverflow){ 4080 showError('warn', 'Option `scrollBar` is mutually exclusive with `scrollOverflow`. Sections with scrollOverflow might not work well in Firefox'); 4081 } 4082 4083 if(options.continuousVertical && options.scrollBar){ 4084 options.continuousVertical = false; 4085 showError('warn', 'Option `scrollBar` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); 4086 } 4087 4088 //anchors can not have the same value as any element ID or NAME 4089 $.each(options.anchors, function(index, name){ 4090 4091 //case insensitive selectors (http://stackoverflow.com/a/19465187/1081396) 4092 var nameAttr = $document.find('[name]').filter(function() { 4093 return $(this).attr('name') && $(this).attr('name').toLowerCase() == name.toLowerCase(); 4094 }); 4095 4096 var idAttr = $document.find('[id]').filter(function() { 4097 return $(this).attr('id') && $(this).attr('id').toLowerCase() == name.toLowerCase(); 4098 }); 4099 4100 if(idAttr.length || nameAttr.length ){ 4101 showError('error', 'data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).');
4102 idAttr.length && showError('error', '"' + name + '" is is being used by another element `id` property'); 4103 nameAttr.length && showError('error', '"' + name + '" is is being used by another element `name` property'); 4104 } 4105 }); 4106 } 4107 4108 /** 4109 * Shows a message in the console of the given type. 4110 */ 4111 function showError(type, text){ 4112 console && console[type] && console[type]('fullPage: ' + text); 4113 } 4114 }; //end of $.fn.fullpage 4115 4116 if(typeof IScroll !== 'undefined'){ 4117 /* 4118 * Turns iScroll `mousewheel` option off dynamically 4119 * https://github.com/cubiq/iscroll/issues/1036 4120 */ 4121 IScroll.prototype.wheelOn = function () { 4122 this.wrapper.addEventListener('wheel', this); 4123 this.wrapper.addEventListener('mousewheel', this); 4124 this.wrapper.addEventListener('DOMMouseScroll', this); 4125 }; 4126 4127 /* 4128 * Turns iScroll `mousewheel` option on dynamically 4129 * https://github.com/cubiq/iscroll/issues/1036 4130 */ 4131 IScroll.prototype.wheelOff = function () { 4132 this.wrapper.removeEventListener('wheel', this); 4133 this.wrapper.removeEventListener('mousewheel', this); 4134 this.wrapper.removeEventListener('DOMMouseScroll', this); 4135 }; 4136 } 4137 4138 /** 4139 * An object to handle overflow scrolling. 4140 * This uses jquery.slimScroll to accomplish overflow scrolling. 4141 * It is possible to pass in an alternate scrollOverflowHandler 4142 * to the fullpage.js option that implements the same functions 4143 * as this handler. 4144 * 4145 * @type {Object} 4146 */ 4147 var iscrollHandler = { 4148 refreshId: null, 4149 iScrollInstances: [], 4150 4151 /** 4152 * Turns off iScroll for the destination section. 4153 * When scrolling very fast on some trackpads (and Apple laptops) the inertial scrolling would 4154 * scroll the destination section/slide before the sections animations ends. 4155 */ 4156 onLeave: function(){ 4157 var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance'); 4158 4159 if(typeof scroller !== 'undefined' && scroller){ 4160 scroller.wheelOff(); 4161 } 4162 4163 4164 }, 4165 4166 // Turns on iScroll on section load 4167 afterLoad: function(){ 4168 4169 var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance'); 4170 if(typeof scroller !== 'undefined' && scroller){ 4171 scroller.wheelOn(); 4172 } 4173 }, 4174 4175 /** 4176 * Called when overflow scrolling is needed for a section. 4177 * 4178 * @param {Object} element jQuery object containing current section 4179 * @param {Number} scrollHeight Current window height in pixels 4180 */ 4181 create: function(element, scrollHeight) { 4182 var scrollable = element.find(SCROLLABLE_SEL); 4183 4184 scrollable.height(scrollHeight); 4185 scrollable.each(function() { 4186 var $this = jQuery(this); 4187 var iScrollInstance = $this.data('iscrollInstance'); 4188 if (iScrollInstance) { 4189 $.each(iscrollHandler.iScrollInstances, function(){ 4190 $(this).destroy(); 4191 }); 4192 } 4193 iScrollInstance = new IScroll($this.get(0), iscrollOptions); 4194 iscrollHandler.iScrollInstances.push(iScrollInstance); 4195 $this.data('iscrollInstance', iScrollInstance); 4196 }); 4197 }, 4198 4199 /** 4200 * Return a boolean depending on whether the scrollable element is a 4201 * the end or at the start of the scrolling depending on the given type. 4202 * 4203 * @param {String} type Either 'top' or 'bottom' 4204 * @param {Object} scrollable jQuery object for the scrollable element 4205 * @return {Boolean} 4206 */ 4207 isScrolled: function(type, scrollable) { 4208 var scroller = scrollable.data('iscrollInstance'); 4209 4210 if (!scroller) { 4211 return false; 4212 } 4213 4214 /* nectar addition */ 4215 if (type === 'top') { 4216 $('#nectar_fullscreen_rows').addClass('nextSectionAllowed'); 4217 return scroller.y >= 0 && !scrollable.scrollTop(); 4218 } else if (type === 'bottom') { 4219 4220 //also changed >= scrollable[0].scrollHeight-4 to scrollable.find('.fp-scroller').height()-4 4221 return (0 - scroller.y) + scrollable.scrollTop() + 1 + scrollable.innerHe
4221ight() >= scrollable.find('.fp-scroller').height() - 4; 4222 } 4223 /* nectar addition end */ 4224 }, 4225 4226 /** 4227 * Returns the scrollable element for the given section. 4228 * If there are landscape slides, will only return a scrollable element 4229 * if it is in the active slide. 4230 * 4231 * @param {Object} activeSection jQuery object containing current section 4232 * @return {Boolean} 4233 */ 4234 scrollable: function(activeSection){ 4235 // if there are landscape slides, we check if the scrolling bar is in the current one or not 4236 if (activeSection.find(SLIDES_WRAPPER_SEL).length) { 4237 return activeSection.find(SLIDE_ACTIVE_SEL).find(SCROLLABLE_SEL); 4238 } 4239 return activeSection.find(SCROLLABLE_SEL); 4240 }, 4241 4242 /** 4243 * Returns the scroll height of the wrapped content. 4244 * If this is larger than the window height minus section padding, 4245 * overflow scrolling is needed. 4246 * 4247 * @param {Object} element jQuery object containing current section 4248 * @return {Number} 4249 */ 4250 scrollHeight: function(element) { 4251 return element.find(SCROLLABLE_SEL).children().first().get(0).scrollHeight; 4252 }, 4253 4254 /** 4255 * Called when overflow scrolling is no longer needed for a section. 4256 * 4257 * @param {Object} element jQuery object containing current section 4258 */ 4259 remove: function(element) { 4260 var scrollable = element.find(SCROLLABLE_SEL); 4261 if (scrollable.length) { 4262 var iScrollInstance = scrollable.data('iscrollInstance'); 4263 iScrollInstance.destroy(); 4264 4265 scrollable.data('iscrollInstance', 'undefined'); 4266 } 4267 element.find(SCROLLABLE_SEL).children().first().children().first().unwrap().unwrap(); 4268 }, 4269 4270 /** 4271 * Called when overflow scrolling has already been setup but the 4272 * window height has potentially changed. 4273 * 4274 * @param {Object} element jQuery object containing current section 4275 * @param {Number} scrollHeight Current window height in pixels 4276 */ 4277 update: function(element, scrollHeight) { 4278 //using a timeout in order to execute the refresh function only once when `update` is called multiple times in a 4279 //short period of time. 4280 //it also comes on handy because iScroll requires the use of timeout when using `refresh`. 4281 clearTimeout(iscrollHandler.refreshId); 4282 iscrollHandler.refreshId = setTimeout(function(){ 4283 $.each(iscrollHandler.iScrollInstances, function(){ 4284 $(this).get(0).refresh(); 4285 }); 4286 }, 150); 4287 4288 //updating the wrappers height 4289 element.find(SCROLLABLE_SEL).css('height', scrollHeight + 'px').parent().css('height', scrollHeight + 'px'); 4290 }, 4291 4292 /** 4293 * Called to get any additional elements needed to wrap the section 4294 * content in order to facilitate overflow scrolling. 4295 * 4296 * @return {String|Object} Can be a string containing HTML, 4297 * a DOM element, or jQuery object. 4298 */ 4299 wrapContent: function() { 4300 return '<div class="' + SCROLLABLE + '"><div class="fp-scroller"></div></div>'; 4301 } 4302 }; 4303 4304});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.