MediaWiki:Common.js: differenze tra le versioni
Vai alla navigazione
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 1: | Riga 1: | ||
$(document).mousemove(function(e){ | |||
if ($('.popup_window:visible').length!==0){ | |||
var width; | |||
var height; | |||
var parent_left = $('.item_container:hover').offset().left; | |||
var parent_top = $('.item_container:hover').offset().top; | |||
var w = e.pageX; | |||
if (e.clientX < ($(window).width())/2){ | |||
width = w + 20 - parent_left; | |||
} else { | |||
width = w - 20 - $('.popup_window:visible').outerWidth() - parent_left; | |||
} | |||
var h = e.pageY; | |||
var h2 = $('.popup_window:visible').outerHeight(); | |||
var h3 =$(window).height(); | |||
if (e.clientY < (h3/2)){ | |||
height = h + 20 - parent_top; | |||
if (e.clientY + h2 +10 > h3) height = h - e.clientY - parent_top + h3 - h2 + 10; | |||
} else { | |||
height = h - h2 - parent_top; | |||
if (e.clientY - h2 < 10) height = h - e.clientY - parent_top + 10; | |||
} | |||
$('.popup_window:visible').css({top: height, left: width}); | |||
} | |||
}); | |||
Versione delle 11:32, 19 dic 2016
$(document).mousemove(function(e){ if ($('.popup_window:visible').length!==0){ var width; var height; var parent_left = $('.item_container:hover').offset().left; var parent_top = $('.item_container:hover').offset().top; var w = e.pageX; if (e.clientX < ($(window).width())/2){ width = w + 20 - parent_left; } else { width = w - 20 - $('.popup_window:visible').outerWidth() - parent_left; } var h = e.pageY; var h2 = $('.popup_window:visible').outerHeight(); var h3 =$(window).height(); if (e.clientY < (h3/2)){ height = h + 20 - parent_top; if (e.clientY + h2 +10 > h3) height = h - e.clientY - parent_top + h3 - h2 + 10; } else { height = h - h2 - parent_top; if (e.clientY - h2 < 10) height = h - e.clientY - parent_top + 10; } $('.popup_window:visible').css({top: height, left: width}); } });