The example of this article is about how the JS control element is displayed in the fixed position of the screen and the monitor screen height changes. Share to everyone for your reference. Specifically as follows:
Control the display position of the logo Begin
window.addeventlistener ("Resize", function () {
//Get screen size (internal/external width, internal/external height)
Changelogoposition ();
}, False);
Changelogoposition ();
function Changelogoposition () {
var contentheight = $ ("#main_content_div"). CSS ("height");
var logoheight = $ ("#third_party_logo"). CSS ("height");
Contentheight = parseint (contentheight.replace (' px ', '));
Logoheight = parseint (logoheight.replace (' px ', '));
Alert (' Screen height: ' +document.body.scrollheight+ ' content height: ' +contentheight+ ' logo height: ' +logoheight ');
if (Document.body.scrollheight-contentheight > Logoheight) {
document.getElementById (' Third_party_logo '). style.position = ' absolute ';
} else {
document.getElementById (' Third_party_logo '). style.position = ';
}
}
Control the display position of the logo end
I hope this article will help you with your JavaScript programming.