function parseURL(input) { const params = new URLSearchParams(input); const payload = {}; for (let [key, val] of params.entries()) { var parsed = key.match(/(.*?)\[(.*?)\]$/); if (parsed) { let [ignore, key, subkey] = parsed; if (subkey) { payload[key] = payload[key] || {}; payload[key][subkey] = val; } else { payload[key] = payload[key] || []; payload[key].push(val); } } else { payload[key] = val; } } return payload; } if ('PerformanceObserver' in window) { (function() { const po = new PerformanceObserver((list) => { for (const entry of list.getEntries()) { if ( ['xmlhttprequest', 'fetch'].includes(entry.initiatorType) && entry.name.indexOf('analytics') === -1 && entry.name.indexOf('googleapis') === -1 ) { 1; _paq.push(['setPagePerformanceTiming', Math.max(entry.connectEnd - entry.startTime, 0), Math.max(entry.responseStart - entry.requestStart, 0), Math.max(entry.responseEnd - entry.responseStart, 0), undefined, undefined, undefined ]); _paq.push(['setCustomUrl', entry.name.split('?').shift()]); _paq.push(['trackPageView', document.title, { dimension1: (entry.duration / 1000).toFixed(1) + 's' }]); _paq.push(['setCustomUrl', location.href]); } } }); po.observe({entryTypes: ['resource']}); })(); } else if ('performance' in window) { } else { } const select = (el, all = false) => { el = el.trim(); if (all) { return [...document.querySelectorAll(el)]; } else { return document.querySelector(el); } }; const on = (type, el, listener, all = false) => { if (all) { select(el, all).forEach(e => e.addEventListener(type, listener)); } else { select(el, all).addEventListener(type, listener); } }; window.addEventListener('DOMContentLoaded', () => { "use strict"; if (window.location.search) { var $logo = $("#header a.logo"); $logo.attr("href", $logo.attr("href") + window.location.search); } const onscroll = (listener) => { $(document).on("scroll", jQuery.throttle(250, listener)); }; try { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i 0) { if ($el.is('[type=checkbox], [type=radio]')) { $('[name="' + name + '"][value="' + value + '"]').first().prop('checked', true); } else { $el.val(value).trigger('change'); } } } } catch (e) { } let navbarlinks = select('#navbar .scrollto', true); const navbarlinksActive = () => { let position = window.scrollY + 200; navbarlinks.forEach(navbarlink => { if (!navbarlink.hash) return; let section = select(navbarlink.hash); if (!section) return; if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) { navbarlink.classList.add('active'); } else { navbarlink.classList.remove('active'); } }) }; window.addEventListener('load', navbarlinksActive); onscroll(navbarlinksActive); const scrollto = (el) => { let header = select('#header'); let offset = header.offsetHeight; if (!header.classList.contains('header-scrolled')) { offset -= 90; } let elementPos = select(el).offsetTop; window.scrollTo({ top: elementPos - offset, behavior: 'smooth' }); }; let selectHeader = select('#header'); if (selectHeader) { const headerScrolled = () => { if (window.scrollY > 100) { selectHeader.classList.add('header-scrolled'); } else { selectHeader.classList.remove('header-scrolled'); } }; window.addEventListener('load', headerScrolled); onscroll(headerScrolled); }; let backtotop = select('.back-to-top'); if (backtotop) { const toggleBacktotop = () => { if (window.scrollY > 100) { backtotop.classList.add('active'); } else { backtotop.classList.remove('active'); } }; window.addEventListener('load', toggleBacktotop); onscroll(toggleBacktotop); $(backtotop).on('click', function(e) { $('.tooltip').hide(); $('html, body').animate({ scrollTop: 0 }); return false; }); } on('click', '.mobile-nav-toggle', function(e) { select('#navbar').classList.toggle('navbar-mobile'); this.classList.toggle('bi-list'); this.classList.toggle('bi-x'); }); on('click', '.navbar .dropdown > a', function(e) { if (select('#navbar').classList.contains('navbar-mobile')) { e.preventDefault(); this.nextElementSibling.classList.toggle('dropdown-active'); } }, true); on('click', '.scrollto', function(e) { if (select(this.hash)) { e.preventDefault(); let navbar = select('#navbar'); if (navbar.classList.contains('navbar-mobile')) { navbar.classList.remove('navbar-mobile'); let navbarToggle = select('.mobile-nav-toggle'); navbarToggle.classList.toggle('bi-list'); navbarToggle.classList.toggle('bi-x'); } scrollto(this.hash); } }, true); on('invalid', 'form *', function(e) { this.closest('form').classList.add('was-validated'); }, true); window.addEventListener('load', () => { if (window.location.hash) { if (select(window.location.hash)) { scrollto(window.location.hash); } } }); new Swiper('.clients-slider', { speed: 400, loop: true, autoplay: { delay: 5000, disableOnInteraction: false }, slidesPerView: 'auto', pagination: { el: '.swiper-pagination', type: 'bullets', clickable: true }, breakpoints: { 320: { slidesPerView: 2, spaceBetween: 40 }, 480: { slidesPerView: 3, spaceBetween: 60 }, 640: { slidesPerView: 4, spaceBetween: 80 }, 992: { slidesPerView: 6, spaceBetween: 120 } } }); $("#header").click(function(e) { if ($(e.target).is("#header, .nav, .container-fluid")) { var $header = $("#header"); var imageurl = $header.css('background-image'); if (imageurl && imageurl != 'none') { if ($header.hasClass('active')) { $('#quick-search').show(); $('#full-search').addClass('d-none').removeClass('active'); } else { $('html, body').animateScroll(0, 1000); $('#full-search').addClass('active'); } $header.toggleClass('active'); track_event(e, 'click', 'header', imageurl.split('/').pop().split('"').shift()); } } }); refreshPage(); scrollTop(); }); function refreshPage() { if (window.Piwik) { $('form').each(function() { var $form = $(this), url = $form.attr('action') || ''; if (url.indexOf('vid=') < 0) { if (url.indexOf('?') < 0) { $form.attr('action', url + '?vid=' + Piwik.getAsyncTracker().getVisitorId()); } else { $form.attr('action', url + '&vid=' + Piwik.getAsyncTracker().getVisitorId()); } } }); } $('[data-activate]').each(function() { var $this = $(this); $this.on($this.attr('data-activate'), function() { $this.removeAttr('data-activate'); }); }); $('.alert.alert-dismissible').each(function() { var $this = $(this); if ($this.hasClass('init')) { return; } else { $this.addClass('init'); } var id = $this.html().hashCode(); if (window.sessionStorage) { if (window.sessionStorage['alert' + id]) { $this.hide(); } else { $this.find('.btn-close').on('click', function() { window.sessionStorage['alert' + id] = true; }); } } }); $('[data-bs-toggle="tooltip"], [title]:not([data-gallery]):not([data-bs-toggle="popover"])').each(function() { var debug = true; var $this = $(this); var $parent = $this.parent(); if ($this.hasClass('init')) { return; } else { $this.addClass('init'); } if ($this.closest('.footer').length > 0) { $parent.css('position', 'relative'); } if (! $this.attr('tabindex')) { $this.attr('tabindex', 0); } $this.on('show.bs.tooltip', function(e) { $('.tooltip[role=tooltip]').attr('shown-at', Date.now()); }); $this.on('shown.bs.tooltip', function() { var $tooltips = $('.tooltip[role=tooltip]'); $tooltips = $tooltips.sort(function(a, b){ return $(b).attr('shown-at') - $(a).attr('shown-at'); }); if ($tooltips.length > 1) { $tooltips.not(':last').tooltip('hide'); $(document.activeElement).blur(); } }); var fallbackPlacements = ['top', 'left', 'right', 'bottom']; var placement = $this.attr('data-bs-placement'); if (placement) { fallbackPlacements = [placement, placement, placement, placement]; } var tooltip = new bootstrap.Tooltip(this, { container: $parent, placement: placement || 'bottom', fallbackPlacements: fallbackPlacements, trigger: 'hover focus blur', html: true }); $this.on('touchstart touchmove touchend click', function(e) { debug && 1; $this.tooltip('show'); }); }); $('[data-bs-toggle="popover"]').each(function() { var debug = true; var $this = $(this); var $parent = $this.parent(); if ($this.hasClass('init')) { return; } else { $this.addClass('init'); } var fallbackPlacements = ['top', 'left', 'right', 'bottom']; var placement = $this.attr('data-bs-placement'); if (placement) { fallbackPlacements = [placement, placement, placement, placement]; } var popover = new bootstrap.Popover(this, { container: $this, trigger: '', offset: [1, 1, 1, 1], html: true, fallbackPlacements: fallbackPlacements, }); var events_to_track = ":hover, :focus, :active"; var double_tap_mode = true; var min_touches = 2; if ($this.is("abbr")) { $this.attr('tabindex', 0); min_touches = 1; } var touches = 0; $this.on("click", function(e) { debug && 1; if (touches == 1) { e.preventDefault(); } else { } }).on("touchstart", function(e) { debug && 1; touches++; }).on("touchend", function(e) { debug && 1; if (double_tap_mode) { if (touches < min_touches) { if (! $this.next('div.popover:visible').length) { $this.popover("show"); $parent.focus(); } $parent.one("blur", function() { debug && 1; $this.popover("hide"); }); return false; } } }).on("mouseenter", function(e) { if (! touches) { debug && 1; if (! $this.next('div.popover:visible').length) { $this.popover("show"); } } }).on("mouseleave", function() { debug && 1; setTimeout(function() { if (! $parent.is(events_to_track) && ! $(events_to_track).filter($this.next('div.popover:visible')).length) { debug && 1; $this.popover("hide"); } touches = 0; }, 100); }); $parent.on("focus", function(e) { debug && 1; var $target = $(e.relatedTarget); if ($target.closest('.modal').length > 0) { $parent.blur(); } else { $this.trigger("mouseenter"); } }).on("blur", function(e) { debug && 1; $this.trigger("mouseleave"); }); $this.on("focus", function(e) { debug && 1; var $target = $(e.relatedTarget); if ($target.closest('.modal').length > 0) { $this.blur(); } else { $this.trigger("mouseenter"); } }).on("blur", function(e) { debug && 1; $this.trigger("mouseleave"); }); if ($this.attr('data-bs-initial') == 'show') { $this.popover('show'); } }); $("input[type=tel], input[name=phone]").each(function() { var $input = $(this); if ($input.hasClass('init')) { return; } else { $input.addClass('init'); } const iti = window.intlTelInput(this, { utilsScript: "assets/vendor/intl-tel-input/utils.js", initialCountry: "auto", preferredCountries: [], geoIpLookup: function(callback) { fetch("https://ipapi.co/json") .then(function(res) { return res.json(); }) .then(function(data) { callback(data.country_code); }) .catch(function() { callback("gb"); }); } }); $input.addClass("ps-5").parent().addClass("d-block").find(".iti__selected-flag").removeAttr("tabindex"); $input.closest("form").on("submit", function() { if ($input.is('[required]') && ! iti.isValidNumber()) { $input.addClass("is-invalid").trigger("invalid"); $input.closest("form").removeClass("was-validated"); return false; } $input.val(iti.getNumber()); }); var old_value = this.value; $input.on("change input paste", function(e) { if (e.type != 'input' && this.value != '') { setTimeout(function() { if (iti.isValidNumber() || ! $input.is('[required]')) { $input.removeClass("is-invalid"); } else { $input.addClass("is-invalid"); } }); } $input[0].setCustomValidity(this.value == '' || iti.isValidNumber() ? "" : "Invalid field"); if (e.type == 'change' && this.value == old_value) { e.stopImmediatePropagation(); } }); $input.on("countrychange", function() { $input.trigger("change"); }); }); if ($('.testimonials-slider').is(':visible') && ! $('.testimonials-slider').is('.init')) { new Swiper('.testimonials-slider', { speed: 600, loop: true, autoplay: { delay: 5000, disableOnInteraction: false }, slidesPerView: 1 }); $('.testimonials-slider').addClass('init'); } window.dispatchEvent(new Event('resize')); lazyload(); } function scrollTopSmooth( to, duration = 300, timingName = "linear" ) { const TIMINGFUNC_MAP = { "linear": t => t, "ease-in": t => t * t, "ease-out": t => t * ( 2 - t ), "ease-in-out": t => ( t < .5 ? 2 * t * t : -1 + ( 4 - 2 * t ) * t ) }; const timingFunc = TIMINGFUNC_MAP[ timingName ]; let start = null; const from = window.scrollY; const distance = to - from; const step = ( timestamp ) => { start = start || timestamp; const progress = Math.round(timestamp - start), time = Math.min( 1, ( ( timestamp - start ) / duration ) ); window.scrollTo( 0, Math.round(from + ( timingFunc( time ) * distance )) ); 1; if ( progress < duration ) { window.requestAnimationFrame( step ); } }; window.requestAnimationFrame( step ); } async function scrollTop(y = 0, speed = 400, cb = null) { 1; await rafscroll().scrollTop(y, speed); if (cb) { cb(); } } $(document).on("click", function(e) { if ($(e.target).closest('.popover').length == 0) { $('.popover.show:visible').trigger("mouseleave"); } }); $(document).on('shown.bs.modal hidden.bs.modal', function(e) { var $modal = $(e.target); if (e.type == 'shown') { if ($modal.parents('.modal').length > 0) { $modal.detach().appendTo('body'); } var zindexes = $(".modal.show").map(function() { return parseInt($(this).css("z-index")); }).get(); var zindex = Math.max(...zindexes, 1060); $(".modal-backdrop.show:not(.stacked)").each(function() { $(this).css("z-index", zindex++).addClass('stacked'); }); $(".modal.show:not(.stacked)").each(function() { $(this).css("z-index", zindex++).addClass('stacked'); }); } else if (e.type == 'hidden') { $(".modal:not(.show)").removeClass('stacked'); } if (e.type == 'hidden') { if ($(".modal.show").length > 0) { const scrollDiv = document.createElement('div'); scrollDiv.className = 'modal-scrollbar-measure'; document.body.appendChild(scrollDiv); const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); $("body").addClass("modal-open").css("padding-right", scrollbarWidth); } } }); $(document).on('input change paste blur', '.is-invalid', function(e) { if (this.value && ! this.validationMessage) { $(this).removeClass('is-invalid'); } }); $(document).on('click', '[type=submit]', function() { var $form = $(this).closest('form'); var disabled = false; $form.find(':input[required]:visible').each(function() { var $input = $(this); if ($input.is(':disabled') || $input.find(':selected').is(':disabled')) { $input.addClass('is-invalid').trigger("invalid"); disabled = true; } else if ($input.is('[readonly]') && $input.val() == '') { $input.addClass('is-invalid').trigger("invalid"); disabled = true; } }); if (disabled) { return false; } }); $(document).on('shown.bs.modal', function(e) { var $modal = $(e.target); var $form = $modal.find('form'); $modal.find('img[data-src]:not(.lazyload):visible').each(function() { var $this = $(this); $this.attr('src', $this.attr('data-src')); }); const lightbox = GLightbox({ selector: '.modal.show .portfolio-lightbox, .modal-inline .portfolio-lightbox', dragToleranceY: 0, slideEffect: 'none', preload: true }); $.each($(e.relatedTarget).data(), function(key, value) { if (!/^bs/.test(key)) { var $copy = $modal.find("[data-" + key + "]"); if ($copy.length == 1) { $copy.attr("data-" + key, value); } else { var selector = 'form :input[name="' + key + '"], [data-bind="' + key + '"]'; if ($modal.find(selector).length == 0) { var $input = $('').attr('name', key); $modal.find('form').append($input); } var $element = $modal.find(selector); if ($element.length > 0) { if ($element[0].nodeName.toLowerCase() === 'a') { $element.toggle(value != ''); if (value.indexOf('http') !== 0) { value = 'http://' + value; } $element.attr('href', value); } else if ($element[0].nodeName.toLowerCase() === 'img') { $element.one('load', function() { $(this).show(); }).hide().attr('src', value); } else if ($element[0].value !== undefined) { $element.val(value); } else { $element.html(value); } } } } }); $modal.find('.ajax-result').hide(); $modal.find('[autofocus]').focus(); if ($modal.find('form').length > 0) { $modal.find('form .is-invalid').removeClass('is-invalid'); $modal.find('form').removeClass('was-validated').each(function() { this.reset(); }); } }); $(document).on('submit', function(e) { var $form = $(e.target); var $button = $(e.originalEvent.submitter); var button_text = $button.html(); if ($form.hasClass('ajax')) { $button.prop('disabled', true).html('  '); if ($form.find('.ajax-result').length == 0) { $button.parent().append(''); } $form.removeClass('was-validated').find('.ajax-result').hide().removeClass('alert-success alert-danger'); $.ajax({ url: $form.attr('action'), method: $form.attr('method'), data: $form.serialize() + '&refer=' + encodeURIComponent(window.location.href) }).done(function(response) { var $result; if ($form.attr('data-ajax-success')) { $result = $($form.attr('data-ajax-success')).html(response); var $scroll = $result; if ($form.attr('data-ajax-scroll')) { $scroll = $($form.attr('data-ajax-scroll')); if ($scroll.length == 0) { $scroll = $result; } } var $body = $form.closest(".modal-body, body"); $body.animate({ scrollTop: $body.is("body") ? $scroll.offset().top : $scroll.position().top }, 1000); } else { $result = $form.find('.ajax-result').html(response).addClass('alert-success').removeClass('d-none'); } var $clone = $result.clone(); $clone.find('script, style').remove(); if ($clone.text() != '') { $result.show(); } }).fail(function(xhr) { $form.find('.ajax-result').html(xhr.responseText || "Something went wrong").addClass('alert-danger').removeClass('d-none').show(); try { window.grecaptcha && grecaptcha.reset(); } catch (e) { } }).always(function(xhr) { $button.prop('disabled', false).html(button_text); }); return false; } }); var last_event = {}; $(function() { $(function() { track_event.init = true; }); }); function track_event(e, category, el, name, value = '') { if (! track_event.init) { return; } var attrs = { action: '', name: '', value: value }; if (el instanceof jQuery) { if (el.closest('[data-event-action]').attr('data-event-action') !== undefined) { attrs['action'] = el.closest('[data-event-action]').attr('data-event-action'); 1; } else { if (( category == 'change' || category == 'invalid') && el.attr('name')) { attrs['action'] = el.attr('name').trim(); } else if (el.closest('[data-id]').attr('data-id') !== undefined) { attrs['action'] = el.closest('[data-id]').attr('data-id').trim(); } else if (el.is('form') && el.attr('action') && el.attr('action').trim()) { attrs['action'] = 'submit'; } else if (el.attr('id') && el.attr('id').trim()) { attrs['action'] = el.attr('id').trim(); } else if ((category != 'change' && category != 'invalid') && el.text() && el.text().trim()) { attrs['action'] = el.text().trim(); } else if (el.attr('href') && el.attr('href') != '#' && el.attr('href').trim()) { attrs['action'] = el.attr('href').trim(); } else if (el.attr('title') && el.attr('title').trim()) { attrs['action'] = el.attr('title').trim(); } else if (el.attr('data-bs-original-title') && el.attr('data-bs-original-title').trim()) { attrs['action'] = el.attr('data-bs-original-title').trim(); } else if (el.is('img') && el.attr('src') && el.attr('src').trim()) { attrs['action'] = el.attr('src').trim(); } else { 1; return; } } } else if (el) { attrs['action'] = el; } else { return; } if (name instanceof jQuery) { el = name; } else if (name != undefined) { attrs['name'] = name; el = null; } if (el && el.is && ! el.is('[type=password], [type=email], [type=tel], [name$=name], textarea')) { if (el.is('[type=checkbox]')) { attrs['name'] = attrs['name'] || el.attr('name'); attrs['value'] = el.is(':checked') ? 1 : 0; } else if (el.is(':input') && el.val().trim()) { attrs['name'] = attrs['name'] || el.attr('name'); value = el.val().trim(); if (value == parseFloat(value)) { attrs['value'] = value; } else { attrs['name'] = value; } } else if (el.is('form') && el.attr('action') && el.attr('action').trim()) { attrs['name'] = el.attr('action').trim().split('?').shift(); } else if (el.attr('href') && el.attr('href') != '#' && el.attr('href').trim()) { attrs['name'] = el.attr('href').trim(); } else if (el.attr('title') && el.attr('title').trim()) { attrs['name'] = el.attr('title').trim(); } else if (el.attr('id') && el.attr('id').trim()) { attrs['name'] = el.attr('id').trim(); } else if (el.attr('data-bs-original-title') && el.attr('data-bs-original-title').trim()) { attrs['name'] = el.attr('data-bs-original-title').trim(); } else if (el.attr('data-bs-target') && el.attr('data-bs-target').trim()) { attrs['name'] = el.attr('data-bs-target').trim().substring(1); } else if (el.is('img') && el.attr('src') && el.attr('src').trim()) { attrs['name'] = el.attr('src').trim(); } else if (el.attr('aria-label') && el.attr('aria-label').trim()) { attrs['name'] = el.attr('aria-label').trim(); } else { attrs['name'] = el.clone().children().remove().end().text().trim(); } if (el.closest('.GMAMP-maps-pin-view').length > 0) { if (el.closest('.GMAMP-maps-pin-view').find('svg + div > i').length > 0) { el = el.closest('.GMAMP-maps-pin-view').find('svg + div > i'); } else if (el.closest('[title]').length > 0) { attrs['name'] = el.closest('[title]').attr('title').trim(); } } if (el.closest('[data-event-name]').attr('data-event-name') !== undefined) { attrs['name'] = el.closest('[data-event-name]').attr('data-event-name'); } if (el.closest('[data-event-value]').attr('data-event-value') !== undefined) { attrs['value'] = el.closest('[data-event-value]').attr('data-event-value'); } } if (el && el.is) { if (! attrs['name'] && category == 'click') { if (! el.closest('a, button, input[type=button], input[type=submit]').length) { 1; return; } } if (el.closest('[data-event-category]').attr('data-event-category') !== undefined) { if (category == 'click') { category = el.closest('[data-event-category]').attr('data-event-category'); } else if (category == 'invalid') { attrs['name'] = attrs['action']; attrs['action'] = category; category = el.closest('[data-event-category]').attr('data-event-category'); } } } if (category == '' || attrs['action'] == '') { return; } if (category == attrs['action']) { attrs['action'] = attrs['name']; } if (attrs['action'] == attrs['name']) { attrs['name'] = ''; } if (attrs['name'] == attrs['value']) { attrs['value'] = ''; } if (typeof e === "object") { var timestamp = e.timeStamp || (new Date).getTime(); if (timestamp && timestamp <= last_event[e.type]) { if (category != 'invalid' && category != 'change') { 1; return; } } else { last_event[e.type] = timestamp; } } else { if (last_event[e]) { 1; return; } else { last_event[e] = true; } } 1; try { if (category == 'error' || category == 'exception') { _paq.push(['trackEvent', 'error', attrs['action'], attrs['name']]); } else { _paq.push(['trackEvent', category, attrs['action'], attrs['name'], attrs['value']]); } } catch (e) { } try { if (category == 'error' || category == 'exception') { gtag('event', category, { 'exDescription': attrs['action'] }); } else { gtag('event', category, { 'event_label': attrs['action'], 'value': attrs['name'] }); } } catch (e) { } } $(document).get(0).addEventListener('click', function(e) { var $target = $(e.target); track_event(e, 'click', $target.closest('a, button, input[type=button], input[type=submit], [data-event-action], [data-event-name]'), $(e.target)); $('[required]').off('invalid.track').on('invalid.track', function(e) { track_event(e, 'invalid', $target); }); }, true); $(document).on('change', function(e) { track_event(e, 'change', $(e.target).filter(':not([type=hidden]):not(#datepicker)')); }); $(document).on('shown.bs.modal hidden.bs.modal', function(e, originalEvent) { var $modal = $(e.target).closest('.modal, .modal-inline'); var $target = $(originalEvent ? originalEvent.relatedTarget : e.relatedTarget); if (e.type == 'shown') { if ($target.is('[href^="#"]')) { var hash = $target.attr('href').substring(1); var $anchor = $modal.find('[id="' + hash + '"]'); if ($anchor.length) { setTimeout(function() { $anchor.trigger('click'); }); } } } setTimeout(function() { if (e.type == 'shown') { track_event(e, 'open', $modal, $target); } else { track_event(e, 'close', $modal, $target); } }); }); $(document).on('submit', function(e) { if (e.target) { var $form = $(e.target); track_event(e, 'submit', $form); } }); $(document).on('click', '.nav-tabs .nav-link', function(e) { if (e.isTrigger) { return; } var $href = $($(this).attr("data-bs-target")); if ($href.closest(".modal-inline").length) { $href.closest(".modal-inline")[0].scrollIntoView({behavior: "instant"}); } else { $href.closest(".modal-body, body").scrollTop(0); } });