If I well understood your question maybe you could
- find the
div containing the first occurence of word
- Get its
offsetTop value
- Make the page scroll for the given amount
Something like
function jumpToWord(word) {
var p = ($.browser.opera)? $("html") : $("html,body"),
d = $("div:contains('" + word + "')").eq(0),
offset = d.offset().top;
p.animate({ scrollTop: offset }, 1000);
}
For the sake of accuracy, if your text is contained in shorter paragraphs, it's probably better search for
$("div p:contains('" + word + "')")