MediaWiki:BibleGet.js: Difference between revisions

no edit summary
No edit summary
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') ){
$bGetTIP.addClass('hidden');
setTimeout(function(){  
$bGetTIP.css({"top":'',"left":''});
$bGetTIP.addClass('hidden');
},500);
$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') ){
$bGetTIP.addClass('hidden');
setTimeout(function(){  
$bGetTIP.css({"top":'',"left":''});
$bGetTIP.addClass('hidden');
},500);
$bGetTIP.css({"top":'',"left":''});
},500);
}
});
});
}
}