MediaWiki:BibleGet.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 36: | Riga 36: | ||
if(!$bGetTIP.hasClass('sticky')){ |
if(!$bGetTIP.hasClass('sticky')){ |
||
if(excessHeight > 0 && excessHeight < rect.y){ |
if(excessHeight > 0 && excessHeight < rect.y){ |
||
⚫ | |||
let newTop = top - excessHeight; |
let newTop = top - excessHeight; |
||
$bGetTIP.css({"top":newTop}); |
$bGetTIP.css({"top":newTop}); |
||
} |
} |
||
if(excessWidth > 0 && excessWidth < rect.x){ |
if(excessWidth > 0 && excessWidth < rect.x){ |
||
⚫ | |||
let newLeft = left - excessWidth; |
let newLeft = left - excessWidth; |
||
$bGetTIP.css({"left":newLeft}); |
$bGetTIP.css({"left":newLeft}); |
||
Riga 107: | Riga 109: | ||
$bGetTIP.css({"top":top,"left":left}); |
$bGetTIP.css({"top":top,"left":left}); |
||
if($bGetTIP.hasClass('sticky') || $bGetTIP.is(':offscreen') ){ |
if($bGetTIP.hasClass('sticky') || $bGetTIP.is(':offscreen') ){ |
||
//are we off the bottom or the right side of the screen, and how much? |
|||
⚫ | |||
⚫ | |||
let rect = $bGetTIP[0].getBoundingClientRect(); |
let rect = $bGetTIP[0].getBoundingClientRect(); |
||
let excessHeight = (rect.y + rect.height) - window.innerHeight; |
let excessHeight = (rect.y + rect.height) - window.innerHeight; |
||
let excessWidth = (rect.x + rect.width) - window.innerWidth; |
|||
//if this amount is less than the distance from the top of the screen, |
//if this amount is less than the distance from the top of the screen, |
||
// then let's just move our div up by that much |
// then let's just move our div up by that much |
||
if(!$bGetTIP.hasClass('sticky') |
if(!$bGetTIP.hasClass('sticky')){ |
||
if(excessHeight > 0 && excessHeight < rect.y){ |
|||
console.log('This element was off the bottom of the screen'); |
|||
let newTop = top - excessHeight; |
|||
$bGetTIP.css({"top":newTop}); |
|||
} |
|||
if(excessWidth > 0 && excessWidth < rect.x){ |
|||
console.log('This element was off the left of the screen'); |
|||
let newLeft = left - excessWidth; |
|||
$bGetTIP.css({"left":newLeft}); |
|||
} |
|||
} else { |
} else { |
||
if(!$bGetTIP.hasClass('sticky')){ |
if(!$bGetTIP.hasClass('sticky')){ |