CSS Lecture (キャンプションなし)
CSS Lecture (キャンプションあり)
<p><a href="http://www.css-lecture.com/" class="screenshot" rel="image/css-lecture.jpg">CSS Lecture</a> (キャンプションなし)</p> <p><a href="http://www.css-lecture.com/" class="screenshot" rel="image/css-lecture.jpg" title="CSS Lecture">CSS Lecture</a> (キャンプションあり)</p>
#screenshot{
position: absolute;
border: 3px solid #333;
background: #444;
padding: 5px;
display: none;
color: #FFF;
text-align: center;
}
this.screenshotPreview = function(){
/* CONFIG */
xOffset = 10;
yOffset = 30;
// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result
/* END CONFIG */
$("a.screenshot").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "
" + this.t : "";
$("body").append("
"+ c +"
");
$("#screenshot")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#screenshot").remove();
});
$("a.screenshot").mousemove(function(e){
$("#screenshot")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
// starting the script on page load
$(document).ready(function(){
screenshotPreview();
});