Netscape 6, Part VII: Object-Oriented DOCJSLIB 3.1: Programming Page Watermarks - Doc JavaScript
Netscape 6, Part VII: Object-Oriented DOCJSLIB 3.1
Programming Page Watermarks
We explained page watermarks in Column 29, DOCJSLIB Version 3.0: Page Watermarks. We create the watermark in the function makeLinkedObject()
. We every so often compute its position by the function waterMark()
, which we call every 100 milliseconds via DOCJSLIB 3.1's function:
myBrowserAPIObj.doThisCommandEveryIntervalMS ("waterMark()", 100);
We use DOCJSLIB 3.1 a lot inside the function waterMark()
, to set and get the watermark position on the page. We also compute the highest Z
index in DOCJSLIB 3.1 as well as set it to the desired value:
function waterMark(){ oldWindowWidth= windowWidth; oldWindowHeight= windowHeight; oldPageScrollLeft= pageScrollLeft; oldPageScrollTop= pageScrollTop; windowWidth = myBrowserAPIObj.getWindowWidth(); windowHeight = myBrowserAPIObj.getWindowHeight(); pageScrollLeft = myBrowserAPIObj.getPageScrollLeft(); pageScrollTop = myBrowserAPIObj.getPageScrollTop(); if ((windowHeight != oldWindowHeight)||(windowWidth != oldWindowWidth)||(pageScrollLeft != oldPageScrollLeft)|| (pageScrollTop != oldPageScrollTop)){ myBrowserAPIObj.setPosFromTop("docjslib", windowHeight + pageScrollTop - (imageHeight + bottomSpacer)); myBrowserAPIObj.setPosFromLeft("docjslib", windowWidth + pageScrollLeft - (imageWidth + rightSpacer)); var topZ = myBrowserAPIObj.findHighestZ(); myBrowserAPIObj.setZposition("docjslib", topZ); } }
Next: Tic-Tac-Toe, popout elements, and watermarks application listing
Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: February 26, 2001
Revised: February 26, 2001
URL: https://www.webreference.com/js/column78/5.html