Adding HTML

Hello I have added a 3rd party widget to my site using a HTML iframe. however one button within the widget doesn’t perform as it should and the widget provider said this is due to the wix code preventing it from working.

https://www.kingdommortgages.co.uk/remortgage

in the mortgage search widget, when you select a product it opens a light box and it’s the “Enquire” button that’s meant to scroll to the form section at the bottom, and it doesn’t.

The provider has asked me to add the below code to my .js file at the bottom. does anyone know how I do this?

1: I tried adding to the iframe as HTML but it didn’t recognise and just displayed the code at bottom of iframe

2: I tried adding to the page code but it didn’t recognise the below commands in bold

3: I tried added to the page footer in settings

any pointers? thanks in advance

//Webtool scroll script
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;

var animateScroll = function () {
currentTime += increment;
var val = Math.easeInOutQuad(currentTime, start, change, duration);
window .scrollBy(0,increment) ;
if (currentTime < duration) {
setTimeout(animateScroll, increment);
}
};
animateScroll();
}

Math.easeInOutQuad = function (currentTime, startValue, changeInValue, duration) {
currentTime /= duration / 2;
if (currentTime < 1) return changeInValue / 2 * currentTime * currentTime + startValue;
currentTime–;
return -changeInValue / 2 * (currentTime * (currentTime - 2) - 1) + startValue;
};

window .addEventListener(‘message’, function(event) {

if( offset = event.data[‘offset’]) {
var target = document .querySelector(“iframe[data=‘iress-toolbox’]”);
scrollTo(target, offset , 1250);
// setTimeout(window.scrollBy(0, 1400), 500);
}
})

Adding code to an HTML component is not a part of the Corvid product (which is what this forum is about). The basics of an HTML component is to put any HTML code in it. That code can be copied from any source that you want, but you need to know the exact code to put there (which is not related to Corvid )… You will need to check with the service provider to find out how to get it work.