How To Disable Auto-scrolling When Using Window.find() Inside An Iframe
I have a search function that finds keywords inside an iFrame that looks like this: const iWindow = iframe.contentWindow; iframe.contentDocument.designMode = 'on'; //This is suppo
Solution 1:
You can disable scroll just before and re-enable it just after the whole while loop is done. Something like this:
window.addEventListener('scroll', noScroll);
// find logicsetTimeout(() =>window.removeEventListener('scroll', noScroll), 500);
Where noScroll
is your function that disables scrolling (something like window.scrollTo(0,0)
). I've found useful adding the setTimeout
in a script I was working on, otherwise the last event won'f fire. It may be useless in your case.
Post a Comment for "How To Disable Auto-scrolling When Using Window.find() Inside An Iframe"