« MediaWiki:Common.js » : différence entre les versions
Aller à la navigation
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 1 : | Ligne 1 : | ||
$(document).mousemove(function(e){ | $(document).mousemove(function(e){ | ||
var width; | |||
var | var height; | ||
var | var parent_left = $('#content').offset().left; | ||
var parent_top = $('#content').offset().top; | |||
var w = e.pageX; | var w = e.pageX; | ||
if (e.clientX < ($(window).width())/2){ | if (e.clientX < ($(window).width())/2){ | ||
width = w + 20; | width = w + 20 - parent_left; | ||
} else { | } else { | ||
width = w - 60 - $('.popup_window').width() | width = w - 60 - $('.popup_window').width() - parent_left; | ||
} | } | ||
var h = e.pageY; | var h = e.pageY; | ||
var h2 = $('.popup_window').height() | var h2 = $('.popup_window').height(); | ||
var h3 =$(window).height() | var h3 =$(window).height(); | ||
if (e.clientY < (h3/2)){ | if (e.clientY < (h3/2)){ | ||
height = h + 10; | height = h + 10 - parent_top; | ||
if (e.clientY + h2 + 30 > h3) height = h + (h3-e.clientY) - h2 - 30 | if (e.clientY + h2 + 30 > h3) height = h + (h3-e.clientY) - h2 - 30 - parent_top; | ||
} else { | } else { | ||
height = h - 40 - h2 | height = h - 40 - h2 - parent_top; | ||
if (e.clientY - h2 < 0) height = h - e.clientY | if (e.clientY - h2 < 0) height = h - e.clientY - parent_top; | ||
} | } | ||
$('.popup_window:visible').css({top: height, left: width}); | $('.popup_window:visible').css({top: height, left: width}); | ||
}); | }); |
Version du 14 juillet 2016 à 08:55
$(document).mousemove(function(e){ var width; var height; var parent_left = $('#content').offset().left; var parent_top = $('#content').offset().top; var w = e.pageX; if (e.clientX < ($(window).width())/2){ width = w + 20 - parent_left; } else { width = w - 60 - $('.popup_window').width() - parent_left; } var h = e.pageY; var h2 = $('.popup_window').height(); var h3 =$(window).height(); if (e.clientY < (h3/2)){ height = h + 10 - parent_top; if (e.clientY + h2 + 30 > h3) height = h + (h3-e.clientY) - h2 - 30 - parent_top; } else { height = h - 40 - h2 - parent_top; if (e.clientY - h2 < 0) height = h - e.clientY - parent_top; } $('.popup_window:visible').css({top: height, left: width}); });