I made a mouse-wheel horizontal-scrolling page, based on code that I found. As you see in the code, there are only 10 pages, but I want to add more. As you scroll through the pages, the menu at right shows your current page. Now, if there were 40 or 50 pages, the menu could not show all of them.
So, how do I show only the current page, or possibly one before the current and one after the current? In other words, pages 3, 4, and 5 in the menu. They would need to change as the user continue scrolling so that only the current page and the before and after pages are showing in the menu.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animation</title>
<link rel="stylesheet" href="13.css">
</head>
<body>
<div class="container">
<section class="sectionA sliding">
<div id="slide1" class="slide" style="background-image:url(2.jpg)"></div>
<div id="slide2" class="slide" style="background-image:url(3.jpg)"></div>
<div id="slide3" class="slide" style="background-image:url(4.jpg)"></div>
<div id="slide4" class="slide" style="background-image:url(5.jpg)"></div>
<div id="slide5" class="slide" style="background-image:url(6.jpg)"></div>
<div id="slide6" class="slide" style="background-image:url(7.jpg)"></div>
<div id="slide7" class="slide" style="background-image:url(8.jpg)"></div>
<div id="slide8" class="slide" style="background-image:url(9.jpg)"></div>
<div id="slide9" class="slide" style="background-image:url(10.jpg)"></div>
<div id="slide10" class="slide" style="background-image:url(11.jpg)"></div></section>
<div class="navBar item">
<div class="line"></div>
<div class="navSectionContent active" id='section_1'> <span>Page 1</span> <button></button></div>
<div class="navSectionContent" id='section_2'> <span>Page 2</span> <button></button></div>
<div class="navSectionContent" id='section_3'> <span>Page 3</span> <button></button></div>
<div class="navSectionContent" id='section_4'> <span>Page 4</span> <button></button></div>
<div class="navSectionContent" id='section_5'> <span>Page 5</span> <button></button></div>
<div class="navSectionContent" id='section_6'> <span>Page 6</span> <button></button></div>
<div class="navSectionContent" id='section_7'> <span>Page 7</span> <button></button></div>
<div class="navSectionContent" id='section_8'> <span>Page 8</span> <button></button></div>
<div class="navSectionContent" id='section_9'> <span>Page 9</span> <button></button></div>
<div class="navSectionContent" id='section_10'> <span>Page 10</span> <button></button></div></div>
<div class="loader"><img src="12.gif"></div></div>
<script src="14.js"></script>
</body></html>
html {
overflow:hidden;
}
body,html {
height:100vh;
}
body {
background:#000;
margin:0;
padding:0;
color:#fff;
font-family:arial;
font-size:12px;
}
div.container {
width:100%!important;
margin:0;
position:relative;
}
.container {
height:100%;
position:relative;
}
.loader {
background:#000;
width:100%;
height:100%;
position:absolute;
left:0;
top:0;
z-index:1000;
}
.loader img {
position:absolute;
margin:auto;
left:0;
right:0;
bottom:0;
top:0;
}
.sectionA {
height:100%;
}
.sectionA::after,.sectionA::before {
display:table;
content:"";
}
.sectionA::after {
clear:both;
zoom:1;
}
.sectionA.sliding {
-webkit-transition:all .4s ease;
-moz-transition:all .4s ease;
-o-transition:all .4s ease;
transition:all 1s ease-in-out .3s;
}
.navBar {
width:100px;
height:590px;
position:fixed;
right:.5vw;
margin:auto;
}
.navBar.item {
height:590px;
top:3vh;
}
.navBar.item .line {
position:absolute;
right:5px;
top:0vh;
height:590px;
width:12px;
border:1px solid #fff;
background:transparent;
}
.navBar::after,.navBar::before {
display:table;
content:"";
}
.navBar::after {
clear:both;
zoom:1;
}
.navBar .navSectionContent {
position:relative;
margin-bottom:46px;
text-align:right;
float:right;
display:inline-block;
clear:both;
}
.navBar button {
width:0;
height:0;
background:transparent;
position:absolute;
top:0;
right:0;
bottom:0;
margin:auto;
border:0;
}
.navBar .navSectionContent.active button {
background:rgba(0,255,0,.7);
width:12px;
height:43px;
position:absolute;
top:0;
right:6px;
bottom:0;
margin:auto;
}
.navBar span {
margin-right:30px;
cursor:pointer;
font-size:12px;
font-weight:200;
display:inline-block;
color:#fff;
background:rgba(0,0,0,.3);
padding:0 4px;
}
.navBar .navSectionContent.active span {
color:#fff;
background:rgba(0,255,0,.3);
padding:12px;
margin-right:18px;
border-radius:8px;
border-top-right-radius:0;
border-bottom-right-radius:0;
border:1px solid rgba(255,255,255,.3);
font-size:14px;
font-weight:400;
}
.slide {
height:100%;
float:left;
}
@media only screen and (max-width:1350px) {
.navBar {
right:19px;
}
}
.slide {
background:#skyblue;
}
var A_util = {
browser: {
hasTouchSupport: 'createTouch' in document,
version: (navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || []) [1],
androidversion: function () {
var e = navigator.userAgent.match(/s*Androids*([0-9]+).?([0-9]+)?.?([0-9]+)?s*/);
return e && e[1] && e[2] ? parseFloat(e[1] + '.' + e[2]) : !(!e || !e[1]) && parseFloat(e[1])},
isWebkit: - 1 < navigator.userAgent.indexOf('AppleWebKit/'),
isMobileSafari: /(ipad|iphone|ipod|android).*apple.*mobile.*safari/.test(navigator.userAgent.toLowerCase()),
isAppleChrome: /crios/.test(navigator.userAgent.toLowerCase()),
isAppleMobileDevice: /(ipad|iphone|ipod)/.test(navigator.userAgent.toLowerCase()),
isAndroidMobileDevice: /android/.test(navigator.userAgent.toLowerCase()),
isTansoDl: navigator.userAgent.toLowerCase().match(/TansoDL/i),
isWindowsPhone: function () {
return !!(navigator.userAgent.toLowerCase().match(/Windows CE|IEMobile|Windows Phone OS/i) || 'XDomainRequest' in window)},
highPixelDensityDisplay: 2 <= window.devicePixelRatio,
iPhone4: 2 <= window.devicePixelRatio && this.isMobileSafari,
currentOrientation: null,
isBlackBerry: function () {
return !!navigator.userAgent.match(/BlackBerry/i)},
isBB10: function () {
return !!navigator.userAgent.match(/BB10/i)},
iOSversion: function () {
var e = window.navigator.userAgent,
t = e.indexOf('OS ');
return ( - 1 < e.indexOf('iPhone') || - 1 < e.indexOf('iPad')) && - 1 < t ? window.Number(e.substr(t + 3, 3).replace('_', '.')) : 0 }},
addClass: function (e, t) {
var n = e && 'object' == typeof e.className ? e.className.baseVal : e.className;
this.hasClass(e, t) || ('object' == typeof e.className ? e.className.baseVal = n += n ? ' ' + t : t : e.className = n += n ? ' ' + t : t)},
addClassMultiple: function (e, t) {
for (var n = 0, a = e.length; n < a; n++) this.hasClass(e[n], t) || (e[n].className ? e[n].className += ' ' + t : e[n].className += t)},
addEventHandler: function (e, t, n) {
e.addEventListener ? e.addEventListener(t, n, !1) : e.attachEvent ? e.attachEvent('on' + t, n) : e['on' + t] = n},
extendSimple: function (e, t) {
for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
return e},
extendDefaults: function (e, t, n) {
var a,
o = Object.prototype.hasOwnProperty;
for (a in t) !o.call(t, a) || 'constructor' === a && e === window || (void 0 === t[a] ? delete e[a] : n && void 0 !== e[a] || (e[a] = t[a]));
return e},
hasClass: function (e, t) {
e = e && 'object' == typeof e.className ? e.className.baseVal : e.className;
return e && new RegExp('(\s|^)' + t + '(\s|$)').test(e)},
removeClass: function (e, t) {
var n = ' ' + (e && 'object' == typeof e.className ? e.className.baseVal : e.className).replace(/[trn]/g, ' ') + ' ';
if (this.hasClass(e, t)) {
for (; 0 <= n.indexOf(' ' + t + ' '); ) n = n.replace(' ' + t + ' ', ' ');
'object' == typeof e.className ? e.className.baseVal = n.replace(/^s+|s+$/g, '') : e.className = n.replace(/^s+|s+$/g, '')}},
removeClassMultiple: function (e, t) {
for (var n = 0, a = e.length; n < a; n++) {
var o = ' ' + e[n].className.replace(/[trn]/g, ' ') + ' ';
if (this.hasClass(e[n], t)) {
for (; 0 <= o.indexOf(' ' + t + ' '); ) o = o.replace(' ' + t + ' ', ' ');
e[n].className = o.replace(/^s+|s+$/g, '')}}},
removeEventHandler: function (e, t, n) {
e.removeEventListener ? e.removeEventListener(t, n, !1) : e.detachEvent ? e.detachEvent('on' + t, n) : e['on' + t] = null},
children: function (e) {
for (var t = e.childNodes, n = [], a = t.length; a--; ) 1 == t[a].nodeType && n.unshift(t[a]);
return n},
triggerEvent: function (e, t) {
var n;
document.createEvent ? ((n = document.createEvent('HTMLEvents')).initEvent(t, !0, !1), e.dispatchEvent(n)) : e.fireEvent('on' + t)},
ajaxGet: function (e) {
var t,n = '';
for (t in e.data) '' != n && (n += '&'),n += t + '=' + encodeURIComponent(e.data[t]);
var a = new XMLHttpRequest;
a.open('GET', e.url + '?' + n, !0),
a.onreadystatechange = function () {
4 === this.readyState && (200 <= this.status && this.status < 400 ? e.success && 'function' == typeof e.success && e.success(JSON.parse(this.responseText)) : console.error('Ajax error occured.'))},a.send()},
ajaxGetData: function (e) {
var t = '';
if (void 0 !== e.data) for (var n in e.data) '' != t && (t += '&'),t += n + '=' + encodeURIComponent(e.data[n]);
var a = e.url,
o = new XMLHttpRequest;
o.open('GET', a, !0),
o.onreadystatechange = function () {
4 === this.readyState && (200 <= this.status && this.status < 400 ? e.success && 'function' == typeof e.success && e.success(this.responseText) : console.error('Ajax error occured.'))},o.send()},
appendString: function (e, t) {
var n = document.createElement('div');
for (n.innerHTML = t; n.firstChild; ) e.appendChild(n.firstChild)},
nextElementSibling: function (e) {
for (; (e = e.nextSibling) && 1 !== e.nodeType; );
return e},
previousElementSibling: function (e) {
for (; (e = e.previousSibling) && 1 !== e.nodeType; );
return e},
closest: function (e, t) {
var n;
for (Element.prototype.matches || (Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (e) {
for (var t = (this.document || this.ownerDocument).querySelectorAll(e), n = t.length; 0 <= --n && t.item(n) !== this; );
return - 1 < n});
null !== e; ) {
if (null !== (n = e.parentElement) && n instanceof Element && n.matches(t)) return n;
e = n}
return null},
setText: function (e, t) {e.textContent ? e.textContent = t : e.innerText = t},
setData: function (e, t, n) {
e.dataset ? (t = t.replace(/[-_]([a-z])/g, function (e) {
return e[1].toUpperCase()
}), e.dataset[t] = n) : e.setAttribute('data-' + t, n)},
getData: function (e, t) {
return e.dataset ? (t = t.replace(/[-_]([a-z])/g, function (e) {
return e[1].toUpperCase()}), e.dataset[t]) : e.getAttribute('data-' + t)},
domReady: function (e) {
function n() {
document.addEventListener ? (document.removeEventListener('DOMContentLoaded', t), window.removeEventListener('load', t)) : (document.detachEvent('onreadystatechange', t), window.detachEvent('onload', t))}
var a = !1,t = function () {
a || !document.addEventListener && 'load' !== event.type && 'complete' !== document.readyState || (a = !0, n(), e())};
if ('complete' === document.readyState) e();
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', t),
window.addEventListener('load', t);
else {
document.attachEvent('onreadystatechange', t),window.attachEvent('onload', t);
var o = !1;
try {o = null == window.frameElement && document.documentElement} catch (e) {}
o && o.doScroll && !function t() {
if (!a) {
try {
o.doScroll('left')
} catch (e) {
return setTimeout(t, 50)}
a = !0,
n(),
e()}}()}},
lastChild: function (e) {
if (!e.children.length) return null;
if (e.lastElementChild) return e.lastElementChild;
for (var t = e.children.length - 1; 0 <= t; --t) {
var n = e.children[t];
if (1 === n.nodeType) return n
}
},
offset: function (e) {
var e = e.getBoundingClientRect(),
t = document.body,
n = document.documentElement,
a = window.pageYOffset || n.scrollTop || t.scrollTop,
o = window.pageXOffset || n.scrollLeft || t.scrollLeft,
r = n.clientTop || t.clientTop || 0,
n = n.clientLeft || t.clientLeft || 0,
t = e.top + a - r,
a = e.left + o - n;
return {
left: Math.round(a),
top: Math.round(t)
}
},
empty: function (e) {
for (; e.firstChild; ) e.removeChild(e.firstChild)
},
preventDefault: function (e) {
e.preventDefault ? e.preventDefault() : e.returnValue = !1
},
toggleClass: function (e, t) {
if (e.classList) e.classList.toggle(t);
else {
for (var n = e.className.split(' '), a = - 1, o = n.length; o--; ) n[o] === t && (a = o);
0 <= a ? n.splice(a, 1) : n.push(t),
e.className = n.join(' ')
}
},
debounce: function (e, t, n) {
function a() {
o = null
}
var o = null;
return function () {
n && n.apply(this, arguments),
o || (e.apply(this, arguments), o = setTimeout(a, t))
}},
areCookiesEnabled: function () {
var e = !!navigator.cookieEnabled;
return void 0 !== navigator.cookieEnabled || e || (document.cookie = 'testcookie', e = - 1 != document.cookie.indexOf('testcookie')),
e
},
isLocalStorageEnabled: function () {
if ('undefined' == typeof localStorage) return !1;
try {
localStorage.removeItem('LsAccessSuccess'),
localStorage.setItem('LsAccessSuccess', 'localStorageEnabledOk'),
localStorage.removeItem('LsAccessSuccess')
} catch (e) {
return !1
}
var e;
return !!A_util.areCookiesEnabled() && ( - 1 == document.cookie.indexOf('local_storage') && ((e = new Date).setTime(e.getTime() + 31536000000), e = ' expires = ' + e.toGMTString() + ';', document.cookie = 'local_storage = 1;' + e + ' path=/;'), !0)
},
storage: {
hasLocalStorage: function () {
try {
localStorage.enableStorage = 1,
localStorage.removeItem('enableStorage')
} catch (e) {
return !1
}
return !0
}(),
defaultExpiry: 1,
saveWithExpiry: function (e, t, n) {
this.hasLocalStorage && ((n = t.expires && !n ? t.expires : n) || (n = new Date).setDate(n.getDate() + this.defaultExpiry), n = n instanceof Date ? n.getTime() : parseInt(n), this.saveItem(e, {
val: t,
expires: n
}))
},
getItem: function (t) {
if (this.hasLocalStorage) {
var e;
try {
e = JSON.parse(localStorage[t])
} catch (e) {
return localStorage[t]
}
return parseInt(e.expires) < (new Date).getTime() ? (this.deleteItem(t), null) : e.val || e
}
},
saveItem: function (e, t) {
this.hasLocalStorage && (t = JSON.stringify('object' == typeof t ? t : {
val: t
}), localStorage.setItem(e, t))
},
deleteItem: function (e) {
this.hasLocalStorage && localStorage.removeItem(e)
},
saveExpiry: function (e, t, n) {
return 'undefined' != typeof Storage && (n = {
value: JSON.stringify(t),
timestamp: (new Date).getTime() + n
}, localStorage.setItem(e, JSON.stringify(n)), t)
},
getExpiry: function (e) {
return 'undefined' != typeof Storage && !!(e = JSON.parse(localStorage.getItem(e))) && (new Date).getTime() < e.timestamp && JSON.parse(e.value)
}
},
ajaxCall: function (n) {
if (null == n || '' == n.url || '' == n.data || '' == n.type) return console.log('ajaxPost: Parameters can't be empty'),
!1;
a = new (1 == n.crossDomain && 'undefined' != typeof XDomainRequest ? XDomainRequest : XMLHttpRequest);
var a,
e,
o = new CustomEvent('ajaxSuccess'),
r = new CustomEvent('ajaxFail'),
t = n.type ? n.type.toUpperCase() : 'GET',
s = '',
c = n.contentType || 'application/x-www-form-urlencoded; charset=UTF-8';
for (e in n.data) '' != s && (s += '&'),
s += e + '=' + encodeURIComponent(n.data[e]);
if ('GET' === t && (0 == n.cache ? n.url += '×tamp=' + Date.now() : n.url += s ? ( - 1 !== n.url.indexOf('?') ? '&' : '?') + s : ''), a.open(t, n.url, !0), '' != n.dataType && 'string' == typeof n.dataType ? a.responseType = n.dataType : a.responseType = 'json', a instanceof XMLHttpRequest && void 0 === n.requestType && (a.setRequestHeader('X-Requested-With', 'XMLHttpRequest'), a.setRequestHeader('Content-Type', c)), '' != n.requestType && 'string' == typeof n.requestType && (s = JSON.stringify(n.data), a.setRequestHeader('Content-Type', n.requestType)), n.headers && (Object.keys || (Object.keys = function (e) {
var t,
n = [
];
for (t in e) e.hasOwnProperty(t) && n.push(t);
return n
}), Object.keys(n.headers).forEach(function (e) {
a.setRequestHeader(e, n.headers[e])
})), 'false' == n.cache && 'POST' == t && a.setRequestHeader('cache-control', 'no-cache'), n.xhrFields) for (i in n.xhrFields) a[i] = n.xhrFields[i];
return 'function' == typeof n.beforeSend && !1 === n.beforeSend() ? a.abort() : (a.onreadystatechange = function () {
var t = {
};
if (4 == a.readyState) if (200 <= a.status && a.status < 400) {
try {
t = JSON.parse(a.responseText)
} catch (e) {
t = a.response
}
'function' == typeof n.success && (a instanceof XMLHttpRequest ? n.success(t) : a.onload(function () {
n.success(t)
})),
a.dispatchEvent(o)
} else a.dispatchEvent(r),
t = {
error: 'Error getting data from AJAX call'
};
if (null != t && void 0 !== t.error) return console.log('ajaxPost: ' + t.error),
!1
}, a.send(s), a.done = function (e) {
'function' == typeof e && (a instanceof XMLHttpRequest ? A_util.addEventHandler(a, 'ajaxSuccess', e) : a.onload = e())
}, a.fail = function (e) {
'function' == typeof e && (a instanceof XMLHttpRequest ? A_util.addEventHandler(a, 'ajaxFail', e) : a.onerror = e())
}, a.always = function (e) {
'function' == typeof e && (a instanceof XMLHttpRequest ? (A_util.addEventHandler(a, 'ajaxSuccess', e), A_util.addEventHandler(a, 'ajaxFail', e)) : (a.onload = e(), a.onerror = e()))
}, a)
},
getEventTarget: function (e) {
return (e = e || window.event).target || e.srcElement
}
};
!function () {
function e(e, t) {
t = t || {
bubbles: !1,
cancelable: !1,
detail: void 0
};
var n = document.createEvent('CustomEvent');
return n.initCustomEvent(e, t.bubbles, t.cancelable, t.detail),
n
}
'function' != typeof window.CustomEvent && (e.prototype = window.Event.prototype, window.CustomEvent = e)
}();
var url = window.location.toString(),
hash = url.substring(url.indexOf('#') + 1),
activeNum = null,
genericFunctionModule = function () {
var n = document.querySelectorAll('.slide'),l = null,i = null;
function r(e, t) {
e = document.querySelector(e);
t = ('0' + t).slice( - 2),e && (e.textContent = t)}
function t() {
var e,t,o,n = (new Date).getTime(),n = i - n;
n < 0 ? clearInterval(l) : n && (e = Math.floor(n / 86400000), t = Math.floor(n % 86400000 / 3600000), o = Math.floor(n % 3600000 / 60000), n = Math.floor(n % 60000 / 1000), r('.js-days', e), r('.js-hours', t), r('.js-mins', o), r('.js-secs', n))
}
return {
widthSlide: function () {
if (n.length) for (var e = 0;
e < n.length; e++) n[e].style.width = window.innerWidth + 'px';
document.querySelector('.sectionA') && (document.querySelector('.sectionA').style.width = window.innerWidth * n.length + 'px', document.querySelector('.sectionA').style.marginLeft = '-' + window.innerWidth * activeNum + 'px'),
document.querySelector('#section_' + (activeNum + 1)) && A_util.addClass(document.querySelector('#section_' + (activeNum + 1)), 'active')
},
faqAlign: function () {
window.innerHeight < 890 ? (document.querySelector('#faqContent') && A_util.addClass(document.querySelector('#faqContent'), 'scrollMin'), document.querySelector('.scrollBar') && (document.querySelector('.scrollBar').style.display = 'block'), document.querySelector('.track1') && (document.querySelector('.track1').style.display = 'block'), setTimeout(function () {
AB_scroll.init({
selector: document.querySelectorAll('#faqContent'),
height: 'auto',
width: 'auto',
color: '#F39000',
size: '7px',
alwaysVisible: !0,
railVisible: !0,
railOpacity: 1,
railColor: '#222',
distance: - 2,
railClass: 'track1',
opacity: '1',
wrapperClass: 'wrapper1'
})
}, 2000), document.querySelector('.modalMTubes') && A_util.addClass(document.querySelector('.modalMTubes'), 'smallModalMTubes')) : (document.querySelector('#faqContent') && A_util.removeClass(document.querySelector('#faqContent'), 'scrollMin'), document.querySelector('.scrollBar') && (document.querySelector('.scrollBar').style.display = 'none'), document.querySelector('.track1') && (document.querySelector('.track1').style.display = 'none'), document.querySelector('.modalMTubes') && A_util.removeClass(document.querySelector('.modalMTubes'), 'smallModalMTubes'))
},
urlActiveSection: function () {
A_util.removeClassMultiple(n, 'active');
for (var e = 0; e < n.length; e++) n[e].id.replace('Slide', '').toLowerCase() === hash.toLowerCase() && A_util.addClass(document.querySelector('#' + n[e].id), 'active')
},
getIndex: function (e) {
if (e) for (var t = e.parentNode.childNodes, o = 0, n = 0; n < t.length; n++) {
if (t[n] == e) return o;
1 == t[n].nodeType && o++
}
return - 1
},
slideFunction: function (e) {
var t = document.querySelectorAll('.navSectionContent'),
o = document.querySelector('.sectionA');
o && A_util.addClass(o, 'sliding'),
e ? activeNum-- : activeNum++,
e = n.length ? n[activeNum] : null,
'undefined' != typeof WIDGET_PREMIUM_SIGNUP && (WIDGET_PREMIUM_SIGNUP.realEstateTracking = changeRealEstateTrackingObj(e, !1)),
A_util.removeClassMultiple(t, 'active'),
(t = document.querySelector('#section_' + (activeNum + 1))) && A_util.addClass(t, 'active'),
o && (o.style.marginLeft = '-' + n[0].clientWidth * activeNum + 'px'),
A_util.removeClassMultiple(n, 'active'),
A_util.addClass(e, 'active')
},
tooltipPromo: function () {
var e = document.querySelector('.tooltipPromoTrigger'),
t = document.querySelector('.tooltipPromo'),
o = (n = e.getBoundingClientRect()).left - (t.offsetWidth - e.offsetWidth) / 2,
n = n.top + e.offsetHeight + 7 + 'px';
t.style.left = o + 'px',
t.style.right = 'auto',
t.style.top = n,
t.style.opacity = 1
},
startTimer: function (e) {
i = new Date(e).getTime(),
l = setInterval(t, 1000)
}
}
}(),
premiumEventHandlersModule = {
faqDropDownClick: function () {
var e = this.parentElement.children;
A_util.toggleClass(this.querySelectorAll('p') [0], 'linearSlide');
for (var t = 0; t < e.length; t++) e[t] !== this && (A_util.removeClass(e[t], 'active'), A_util.removeClassMultiple(e[t].querySelectorAll('p'), 'linearSlide'));
A_util.toggleClass(this, 'active')
},
navBarClick: function () {
var e = document.querySelectorAll('.navSectionContent');
activeNum = genericFunctionModule.getIndex(this) - 1,
allSlides = document.querySelectorAll('.slide'),
'undefined' != typeof WIDGET_PREMIUM_SIGNUP && (WIDGET_PREMIUM_SIGNUP.realEstateTracking = changeRealEstateTrackingObj(allSlides[activeNum], !1)),
document.querySelector('.sectionA') && (A_util.addClass(document.querySelector('.sectionA'), 'sliding'), document.querySelector('.sectionA').style.marginLeft = '-' + document.querySelector('.slide').clientWidth * activeNum + 'px'),
A_util.removeClassMultiple(e, 'active'),
A_util.addClass(this, 'active')
},
hashChangeEvent: function () {
genericFunctionModule.urlActiveSection(),
activeNum = genericFunctionModule.getIndex(document.querySelector('.navSectionContent.active')) - 1,
A_util.removeClass(document.querySelector('.navSectionContent'), 'active'),
document.querySelector('#section_' + (activeNum + 1)) && A_util.addClass(document.querySelector('#section_' + (activeNum + 1)), 'active'),
genericFunctionModule.widthSlide()
},
resizeFunction: function () {
document.querySelector('.sectionA') && A_util.removeClass(document.querySelector('.sectionA'), 'sliding'),
genericFunctionModule.widthSlide(),
genericFunctionModule.faqAlign()
},
mouseUpFunction: function (e) {
joinPageUrlParam.reloadParamsOnModalClose(e.target)
},
mouseScrollFunction: function (e) {
document.querySelector('.modalMTubes.premiumSignupModal') || 0 !== document.querySelectorAll('.scrollOn').length || (0 < e.wheelDelta || e.detail < 0 ? 0 < activeNum && genericFunctionModule.slideFunction(!0) : activeNum < document.querySelectorAll('.slide').length - 1 && genericFunctionModule.slideFunction(!1))
}
};
function changeRealEstateTrackingObj(e, t) {
return (jslide = t ? document.querySelector('.slide.active') : e) && jslide.dataset && jslide.dataset.tracking ? jslide.dataset.tracking : ''
}
A_util.domReady(function () {
var e,
t,
o,
n = document.querySelectorAll('.slide'),
l = ('undefined' != typeof WIDGET_PREMIUM_SIGNUP && (WIDGET_PREMIUM_SIGNUP.realEstateTracking = changeRealEstateTrackingObj(n, !0)), 1 < url.indexOf('#') ? genericFunctionModule.urlActiveSection() : A_util.addClass(document.querySelector('#slide1'), 'active'), activeNum = genericFunctionModule.getIndex(document.querySelector('.navSectionContent.active')) - 1, document.querySelectorAll('.navSectionContent')),
i = document.querySelectorAll('.dropDownContent'),
n = document.querySelector('#faqContent');
if (l.length) for (var r = 0; r < l.length; r++) A_util.addEventHandler(l[r], 'click', premiumEventHandlersModule.navBarClick);
if (i.length) for (r = 0; r < i.length; r++) A_util.addEventHandler(i[r], 'click', premiumEventHandlersModule.faqDropDownClick),
A_util.addEventHandler(i[r], 'keypress', premiumEventHandlersModule.faqDropDownClick);
n && (A_util.addEventHandler(document.querySelector('#faqContent'), 'DOMMouseScroll', function (e) {
e.stopPropagation()
}), A_util.addEventHandler(document.querySelector('#faqContent'), 'mousewheel', function (e) {
e.stopPropagation()
}), A_util.addEventHandler(n, 'mouseover', function (e) {
window.innerHeight < 860 && A_util.addClass(this, 'scrollOn')
}), A_util.addEventHandler(n, 'mouseleave', function (e) {
A_util.removeClass(this, 'scrollOn')
})),
A_util.addEventHandler(window, 'hashchange', premiumEventHandlersModule.hashChangeEvent),
A_util.addEventHandler(window, 'resize', premiumEventHandlersModule.resizeFunction),
A_util.addEventHandler(document, 'mouseup', premiumEventHandlersModule.mouseUpFunction),
A_util.addEventHandler(window, 'mousewheel', premiumEventHandlersModule.mouseScrollFunction),
A_util.addEventHandler(window, 'DOMMouseScroll', premiumEventHandlersModule.mouseScrollFunction),
document.querySelector('.sectionA .logo a') && A_util.addEventHandler(document.querySelector('.sectionA .logo a'), 'click', function (e) {
e.preventDefault(),
document.querySelector('#section_1') && document.querySelector('#section_1').click()
}),
document.querySelector('.tooltipPromo') && (document.querySelector('.tooltipPromo span') && A_util.addEventHandler(document.querySelector('.tooltipPromo span'), 'click', function (e) {
e.stopPropagation(),
A_util.setCookie('promoTooltip', 1);
e = document.querySelector('.tooltipPromo');
e && e.parentNode.removeChild(e)
}), e = setInterval(function () {
0 !== document.querySelector('.tooltipPromoTrigger').getBoundingClientRect().top && (genericFunctionModule.tooltipPromo(), clearInterval(e), A_util.addEventHandler(window, 'resize', genericFunctionModule.tooltipPromo))
}, 100)),
(n = document.querySelector('.promoDeal')) && (t = n.querySelector('span'), o = document.querySelector('.lifeTimeOffer'), n.addEventListener('click'), n.click()),
genericFunctionModule.faqAlign(),genericFunctionModule.widthSlide(),document.querySelector('.offerLifeTime') && document.querySelector('#offersBlock .offer') && (document.querySelector('.offerLifeTime').dataset.paymentType = document.querySelectorAll('#offersBlock .offer') [0].dataset.paymentType),
PREMIUM_SIGNUP.isPreBlackFriday && genericFunctionModule.startTimer('Nov 26, 2020 00:00:00 GMT-0500'),premiumSignupModal.init()}),
document.addEventListener('DOMContentLoaded', function () {document.querySelector('.loader') && (document.querySelector('.loader').style.display = 'none')});