Tim Hughes

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromTim Hughes
ToMe
Subjectfindinpage how to highlight results at top not bottom
Date21 June 2009 00:25
I am using your findinpage js file and would like to know how to have the
item on the page it finds to be highlighted at the top of the page and not
the bottom. For example, on your
http://www.howtocreate.co.uk/jslibs/otherdemo.html#fip page, search for 'How
does this work', the selection is at the bottom, not the top...this is my
page by the way... [URL]

Thank you much,

Tim
FromMe
ToTim Hughes
SubjectRe: findinpage how to highlight results at top not bottom
Date22 June 2009 10:12
Tim,

> I am using your findinpage js file and would like to know how to have
> the item on the page it finds to be highlighted at the top of the
> page and not the bottom.

The browser chooses how far to scroll the page when highlighting matches.
Each browser is free to handle it in whatever way that browser decides. The
script has no control over that.

(It may be possible to hack a solution by detecting the position of the
selection range, and scroll the page that far. However, that would be
unreliable if the document has any scrollable containers, and is far beyond
the scope of the script, which simply hooks into the browser's own searching
functionality.)


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromTim Hughes
ToMe
SubjectRe: findinpage how to highlight results at top not bottom
Date23 June 2009 00:09
Thx for the response....
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.