2 354
contributi
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 42: | Riga 42: | ||
if(excessWidth > 0 && excessWidth < rect.x){ | if(excessWidth > 0 && excessWidth < rect.x){ | ||
console.log('This element was off the right hand side of the screen'); | console.log('This element was off the right hand side of the screen'); | ||
let newLeft; | |||
if($span.offset().left > rect.width){ | |||
newLeft = $span.offset().left - rect.width; | |||
} else { | |||
newLeft = $span.offset().left - rect.width / 2; //center it on the span as a last resort! | |||
} | |||
$bGetTIP.css({"left":newLeft}); | $bGetTIP.css({"left":newLeft}); | ||
} | } | ||
Riga 125: | Riga 129: | ||
if(excessWidth > 0 && excessWidth < rect.x){ | if(excessWidth > 0 && excessWidth < rect.x){ | ||
console.log('This element was off the right hand side of the screen'); | console.log('This element was off the right hand side of the screen'); | ||
let newLeft; | |||
if($span.offset().left > rect.width){ | |||
newLeft = $span.offset().left - rect.width; | |||
} else { | |||
newLeft = $span.offset().left - rect.width / 2; //center it on the span as a last resort! | |||
} | |||
$bGetTIP.css({"left":newLeft}); | $bGetTIP.css({"left":newLeft}); | ||
} | } |
contributi