This article describes how to display javascript control elements at fixed locations on the screen and monitor screen height changes. It involves javascript related operations on page elements and style attributes, for more information about how to display js control elements at fixed locations on the screen and monitor screen height changes, see the following example. Share it with you for your reference. The details are as follows:
// Control the display position of the logo Beginwindow. addEventListener ("resize", function () {// obtain the screen size (internal/external width, internal/external height) changeLogoPosition () ;}, false); changeLogoPosition (); function changeLogoPosition () {var contentHeight = $ ("# main_content_p" ).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 = ''; }}// controls the End position of the logo.
I hope this article will help you design javascript programs.