Füg es nach der 3. Zeile ein.
habe den schnipsel wie du gesagt hast nach /* CONFIG */ nach der 3zeile eingefügt.
gibt keine änderung das imag bleibt trotzdem nicht im viewport.
andere vorschläge?
lösungsansatz:
this.screenshotPreview = function(){
/* CONFIG */
$(".imagescreenshot").mousemove(function(e){
var posY;
if (e.pageY - $(window).scrollTop() + $('#screenshot').height() >= $(window).height() ) {
posY = $(window).height() + $(window).scrollTop() - $('#screenshot').height() - 15 ;
} else {
posY = e.pageY - 15;
}
$("#screenshot")
.css("top",(posY) + "px")
.css("left",(e.pageX + 15) + "px");
});
xOffset = 115;
yOffset = 160;
// 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 != "") ? "<br/>" + this.t : "";
$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='loading...' width='150' />"+ c +"</p>");
$("#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();
});