Agent Search
MEET THE TEAM
View our passionate estate agents, assistants and support staff
/*!
* anchorScroll v2
*
* Author: Virgiliu Diaconu
* http://www.virgiliudiaconu.com
* Licensed under the MIT license.
*/
class AnchorScroll{constructor(t,s={}){this.el=t,this.options=Object.assign({},AnchorScroll.defaultOptions,s),this.init()}init(){this.el.addEventListener("click",t=>{t.preventDefault();const s=document.querySelector(this.el.hash);let o=this.el.getAttribute("data-class-to");if(s){const t=s.getBoundingClientRect().top+window.scrollY-this.options.offsetTop;o="this"===o?this.el:o;const l=this.el.getAttribute("data-scroll-start"),i=this.el.getAttribute("data-scroll-end");"function"==typeof this.options.scrollStart&&this.options.scrollStart.call(this.el);const e=o?document.querySelector(o):s;if(e){if(l){l.split(" ").forEach(t=>e.classList.add(t))}if(!this.el.hasAttribute("data-keep-end")&&i){i.split(" ").forEach(t=>e.classList.remove(t))}}window.scrollTo({top:t,behavior:"smooth"});let c=-1;const n=setInterval(()=>{if(c===window.scrollY){if(clearInterval(n),e){if(i){i.split(" ").forEach(t=>e.classList.add(t))}if(!this.el.hasAttribute("data-keep-start")&&l){l.split(" ").forEach(t=>e.classList.remove(t))}}"function"==typeof this.options.scrollEnd&&this.options.scrollEnd.call(this.el)}else c=window.scrollY},100)}})}}function initAnchorScroll(t,s){t.forEach(t=>new AnchorScroll(t,s))}AnchorScroll.defaultOptions={offsetTop:0};