Last change
on this file since 4877 was
3531,
checked in by tiico, 15 years ago
|
First revision (for testing)
Only in French (translation to be done)
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * Url preview script |
---|
3 | * powered by jQuery (http://www.jquery.com) |
---|
4 | * |
---|
5 | * written by Alen Grakalic (http://cssglobe.com) |
---|
6 | * |
---|
7 | * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | this.screenshotPreview = function(){ |
---|
12 | /* CONFIG */ |
---|
13 | |
---|
14 | xOffset = 10; |
---|
15 | yOffset = 30; |
---|
16 | |
---|
17 | // these 2 variable determine popup's distance from the cursor |
---|
18 | // you might want to adjust to get the right result |
---|
19 | |
---|
20 | /* END CONFIG */ |
---|
21 | $("a.screenshot").hover(function(e){ |
---|
22 | this.t = this.title; |
---|
23 | this.title = ""; |
---|
24 | var c = (this.t != "") ? "<br/>" + this.t : ""; |
---|
25 | $("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>"); |
---|
26 | $("#screenshot") |
---|
27 | .css("top",(e.pageY - xOffset) + "px") |
---|
28 | .css("left",(e.pageX + yOffset) + "px") |
---|
29 | .fadeIn("fast"); |
---|
30 | }, |
---|
31 | function(){ |
---|
32 | this.title = this.t; |
---|
33 | $("#screenshot").remove(); |
---|
34 | }); |
---|
35 | $("a.screenshot").mousemove(function(e){ |
---|
36 | $("#screenshot") |
---|
37 | .css("top",(e.pageY - xOffset) + "px") |
---|
38 | .css("left",(e.pageX + yOffset) + "px"); |
---|
39 | }); |
---|
40 | }; |
---|
41 | |
---|
42 | |
---|
43 | // starting the script on page load |
---|
44 | $(document).ready(function(){ |
---|
45 | screenshotPreview(); |
---|
46 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.