0

How to start a text search from the current scroll position in a web page using window.find()?

There is a floating, 'scroll free' div in a webpage with a search input text box, next and prev buttons. If we scroll down and start a text search, the web page scrolls up to the top of the page and starts the search from the top. But the requirement is to start the search from the current scroll position.

The search is done by using window.find() and it's working, but the only problem is that it always starts from the top instead of from the current scroll position.

Please help.

ProgrammerPer
  • 1,125
  • 1
  • 11
  • 26
Vinochan
  • 15
  • 3
  • you should provide more code. What do you have done for now? But you should have a look into this question https://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport – MattOpen Jul 09 '19 at 06:28
  • You should get the current scrolling position and "reload" the page in this position by using window.location.href -- this should force the window.find() function to search from the current position down the page. – Tomasz Dec 02 '19 at 01:14

0 Answers0