$(function () { $("link[href='https://info.versapay.com/hs-fs/hub/433648/hub_generated/template_assets/1645903852/1615919719885/Coded_files/Custom/page/Solupay_Sept2014-theme/Solupay_Sept2014-style.min.css']").remove(); $('.accordion-header').on('click', function () { var $button = $(this); var $parent = $button.parent(); var $content = $button.next(); var isExpanded = $button.attr('aria-expanded') === 'true'; // Collapse all sections $('.accordion-header').attr('aria-expanded', 'false').parent().removeClass('active'); $('.accordion-header').next().css('max-height', '0'); // Expand the clicked section if it was not already expanded if (!isExpanded) { $button.attr('aria-expanded', 'true'); $parent.addClass('active'); $content.css('max-height', $content[0].scrollHeight + 'px'); } // Update image src dynamically from data-callout attribute var $img = $('#accordionImg'); var calloutPath = $parent.data('callout'); if ($img.length && calloutPath) { $img.attr('src', "https://info.versapay.com/hubfs/Marketbridge/VER0001/images/mb-ver0001-callout-" + calloutPath + ".png"); } }); function scrollToElementById(elementId, duration) { var $targetElement = $('#' + elementId); if ($targetElement.length === 0) return; var startPosition = $(window).scrollTop(); var targetPosition = $targetElement.offset().top; var distance = targetPosition - startPosition; var startTime = performance.now(); function animation(currentTime) { var timeElapsed = currentTime - startTime; var run = easeInOutQuad(timeElapsed, startPosition, distance, duration); $(window).scrollTop(run); if (timeElapsed < duration) { requestAnimationFrame(animation); } } function easeInOutQuad(t, b, c, d) { t /= d / 2; if (t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; } requestAnimationFrame(animation); } $(document).on('click', '[href="#contactForm"]', function (e) { e.preventDefault(); scrollToElementById('contactForm', 2000); }); // Check for 'editor' in the window URL and display modal statically if (window.location.href.indexOf('hubspotpreview') !== -1) { $('.modal').css('display', 'block').css('max-width', '100%').css('box-shadow', 'none'); } })