« MediaWiki:Common.js » : différence entre les versions
Aller à la navigation
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 17 : | Ligne 17 : | ||
if (e.clientY < (h3/2)){ | if (e.clientY < (h3/2)){ | ||
height = h + 20 - parent_top; | height = h + 20 - parent_top; | ||
if (e.clientY + h2 - 20 > h3) height = h | if (e.clientY + h2 - 20 > h3) height = h e.clientY - parent_top + h3 - h2 ; | ||
} else { | } else { | ||
height = h - h2 - parent_top; | height = h - h2 - parent_top; | ||
if (e.clientY - h2 < | if (e.clientY - h2 < 33) height = h - e.clientY - parent_top + 35; | ||
} | } | ||
$('.popup_window:visible').css({top: height, left: width}); | $('.popup_window:visible').css({top: height, left: width}); | ||
} | } | ||
}); | }); |
Version du 16 juillet 2016 à 17:32
$(document).mousemove(function(e){ if ($('.popup_window:visible').length!==0){ console.log(e); var width; var height; var parent_left = $('.mycontainer:hover').offset().left; var parent_top = $('.mycontainer: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 - 20 > h3) height = h e.clientY - parent_top + h3 - h2 ; } else { height = h - h2 - parent_top; if (e.clientY - h2 < 33) height = h - e.clientY - parent_top + 35; } $('.popup_window:visible').css({top: height, left: width}); } });