MediaWiki:BibleGet.js: Difference between revisions
no edit summary
Johnrdorazio (talk | contribs) No edit summary |
Johnrdorazio (talk | contribs) No edit summary |
||
Line 36: | Line 36: | ||
let newTop = top - excessHeight; | let newTop = top - excessHeight; | ||
$bGetTIP.css({"top":newTop}); | $bGetTIP.css({"top":newTop}); | ||
} else { | |||
$bGetTIP.addClass('sticky'); | |||
//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,"height":"90vh","overflow-y":"auto"}); | |||
} | } | ||
} | } | ||
Line 51: | Line 56: | ||
let $bGetTIP = $("div[data-version='"+version+"'][data-ref='"+ref+"']"); | let $bGetTIP = $("div[data-version='"+version+"'][data-ref='"+ref+"']"); | ||
//console.log('I found ' + $bGetTIP.length + ' div(s) at the bottom of the page with this bible quote'); | //console.log('I found ' + $bGetTIP.length + ' div(s) at the bottom of the page with this bible quote'); | ||
setTimeout(function(){ | if(!$bGetTIP.hasClass('sticky') ){ | ||
setTimeout(function(){ | |||
$bGetTIP.addClass('hidden'); | |||
$bGetTIP.css({"top":'',"left":''}); | |||
},500); | |||
} | |||
}); | }); | ||
} else { | } else { | ||
Line 95: | Line 102: | ||
let newTop = top - excessHeight; | let newTop = top - excessHeight; | ||
$bGetTIP.css({"top":newTop}); | $bGetTIP.css({"top":newTop}); | ||
} else { | |||
$bGetTIP.addClass('sticky'); | |||
//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,"height":"90vh","overflow-y":"auto"}); | |||
} | } | ||
} | } | ||
Line 108: | Line 120: | ||
$span.on('mouseleave', function(){ | $span.on('mouseleave', function(){ | ||
setTimeout(function(){ | if(!$bGetTIP.hasClass('sticky') ){ | ||
setTimeout(function(){ | |||
$bGetTIP.addClass('hidden'); | |||
$bGetTIP.css({"top":'',"left":''}); | |||
},500); | |||
} | |||
}); | }); | ||
} | } |