2 354
contributi
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 38: | Riga 38: | ||
console.log('This element was off the bottom of the screen'); | console.log('This element was off the bottom of the screen'); | ||
let newTop = top - excessHeight; | let newTop = top - excessHeight; | ||
$bGetTIP.css({"top":newTop}); | |||
} else if (excessHeight > rect.y){ | |||
$bGetTIP.addClass('sticky'); | |||
$bGetTIP.append($('<div>',{class:'closeButton',text:'x'})); | |||
$bGetTIP.on('click','.closeButton',function(){ | |||
$bGetTIP.addClass('hidden'); | |||
$bGetTIP.css({"top":'',"left":''}); | |||
}); | |||
//distance of the top of the current window from the top of the document | |||
let newTop = (window.pageYOffset || (document.documentElement || document.body.parentNode || document.body).scrollTop) + 20; | |||
$bGetTIP.css({"top":newTop}); | $bGetTIP.css({"top":newTop}); | ||
} | } | ||
Riga 50: | Riga 60: | ||
$bGetTIP.css({"left":newLeft}); | $bGetTIP.css({"left":newLeft}); | ||
} | } | ||
} | } | ||
} | } | ||
Riga 125: | Riga 123: | ||
console.log('This element was off the bottom of the screen'); | console.log('This element was off the bottom of the screen'); | ||
let newTop = top - excessHeight; | let newTop = top - excessHeight; | ||
$bGetTIP.css({"top":newTop}); | |||
} else if (excessHeight >= rect.y){ | |||
$bGetTIP.addClass('sticky'); | |||
$bGetTIP.append($('<div>',{class:'closeButton',text:'x'})); | |||
$bGetTIP.on('click','.closeButton',function(){ | |||
$bGetTIP.addClass('hidden'); | |||
$bGetTIP.css({"top":'',"left":''}); | |||
}); | |||
//distance of the top of the current window from the top of the document | |||
let newTop = (window.pageYOffset || (document.documentElement || document.body.parentNode || document.body).scrollTop) + 20; | |||
$bGetTIP.css({"top":newTop}); | $bGetTIP.css({"top":newTop}); | ||
} | } | ||
Riga 137: | Riga 145: | ||
$bGetTIP.css({"left":newLeft}); | $bGetTIP.css({"left":newLeft}); | ||
} | } | ||
} | } | ||
} | } |
contributi