Previewing Links with Ajax

There’s a handy and great-looking visual effect that many sites are using now, where, when you hover the mouse pointer over a link, the first few lines of the page that is the link’s destination appear in a floating window under the cursor (Figure 13.6). This turns out to be a fairly easy-to-create Ajax application. You’ll find the HTML in Script 13.13, the CSS in Script 13.14, and the JavaScript in Script 13.15.

Figure 13.6. When you hover over a link, this script reads the HTML file on the server and gives you an overlay containing a preview of the first few lines of the file.

To use Ajax to preview links:

1. ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.