Javascript-форум (https://javascript.ru/forum/)
-   Элементы интерфейса (https://javascript.ru/forum/dom-window/)
-   -   проблема с tooltip (https://javascript.ru/forum/dom-window/8161-problema-s-tooltip.html)

forlord 11.03.2010 12:54

проблема с tooltip
 
Помогите разобраться со скриптом
Он полностью рабочий, но когда ссылка оказывается внизу страницы, рисунок уходит под экран, как сделать, чтобы он отображался вверху а не внизу.
пробывал через if, но вероятно что-то не правильно делаю, никак немогу заставить его правильно работать
this.screenshotPreview = function(){	
		xOffset = 10;
		yOffset = 30;
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='фото' />"+ 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();
});


Часовой пояс GMT +3, время: 00:16.