2 354
contributi
(Creata pagina con "//avoid duplicate bibleQuote divs let bibleQuoteCollection = []; let domCheckInterval = []; let ajaxCount = 0; let BibleQuotesDomElements = []; (function($,mw){ $(document).r...") |
Nessun oggetto della modifica |
||
Riga 31: | Riga 31: | ||
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') && excessHeight < rect.y){ | if(!$bGetTIP.hasClass('sticky')){ | ||
if(excessHeight > 0 && excessHeight < rect.y){ | |||
let newTop = top - excessHeight; | |||
$bGetTIP.css({"top":newTop}); | |||
} | |||
if(excessWidth > 0 && excessWidth < rect.x){ | |||
let newLeft = left - excessWidth; | |||
$bGetTIP.css({"left":newLeft}); | |||
} | |||
} else { | } else { | ||
if(!$bGetTIP.hasClass('sticky')){ | if(!$bGetTIP.hasClass('sticky')){ |
contributi