Wrote some jQuery code that, at least for me, looks and works better than the code in the post you're talking about. Hope this fits your needs :)
There's also a live demo at http://jsfiddle.net/gFTrS/2/
HTML
<div class="textWrapper"> <div class="highlight"></div> <p>Your text goes here</p> </div>
CSS
.textWrapper { position: relative; width: 600px; padding: 0px 10px; margin: 0 auto; cursor: default; } .textWrapper p { font: normal 12px Arial; color: #000000; line-height: 18px; padding: 0; margin: 0; } .highlight { position: absolute; top: 0; left: 0; width: 100%; height: 18px; background: yellow; z-index: -1; display: none; }
JQuery
$(document).ready(function() { var lineHeight = 18; $('.textWrapper').hover(function() { $('.highlight', this).show(); $(this).mousemove(function(e) { var relativePos = e.pageY - this.offsetTop; var textRow = (Math.ceil(relativePos / lineHeight) * lineHeight) - lineHeight; if (textRow => 0) { $('.highlight', this).css('top', textRow + 'px'); } }); }, function() { $('.highlight', this).hide(); }); });
source share