Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: How to make an image rest in the lower right corner of the window?


Message #1 by "krenders" <krenderssubscrip@t...> on Sat, 21 Apr 2001 14:20:08
Hi Imar,
Thanks for your reply. I am going to try that script you included.
Thanks again,
Kurt.

> I'd say: check out the source.
> 
> I usually search for the name of the image, for instance. In this case, 
it 
> won't be found. Then search for the .js extension.
> If you do, you'll find this:
> 
> <SCRIPT LANGUAGE="JavaScript1.2" SRC="/js/onlineopinion.js"></SCRIPT>
> 
> This will give you a clue that you can download the JS source file at:
> http://www.adobe.com/js/onlineopinion.js
> 
> This source file is the "engine" behind the sticky image. Don't steal 
the 
> code directly, but get inspired by what you see there and try to build 
it 
> yourself.
> They tried to make it hard to understand what is happening by adding all 
> content on one or two lines. Add a few returns, and it should be clearer.
> 
> Or try the following script.
> 
> 
> Hope this helps,
> 
> Imar
> 
> 
> <DIV id="waterMark" style="position:absolute"><a href="#" title="To top" 
> onClick="window.scrollTo(0,0)"><img src="images/top.gif" 
border="0"></a></DIV>
> 
> <script language="JavaScript1.2">
> <!--
> 
> // Based on watermark script by Paul Anderson, CNET Builder.com. All 
rights 
> reserved.
> markW = 90;       // pixels wide
> markH = 40;       // pixels high
> markX = 15;      // percent right
> markY = 99;      // percent down
> markRefresh = 50; // milliseconds
> 
> // set common object reference
> if (!document.all) document.all = document;
> if (!document.all.waterMark.style) document.all.waterMark.style = 
> document.all.waterMark;
> 
> wMark = document.all.waterMark.style;
> wMark.width = markW;
> wMark.height = markH;
> navDOM = window.innerHeight; // Nav DOM flag
> 
> function setVals() {
>   barW = 0; // scrollbar compensation for PC Nav
>   barH = 0;
>   if (navDOM) {
>    if (document.height > innerHeight) barW = 20;
>    if (document.width > innerWidth) barH = 20;
>    } else {
>    innerWidth = document.body.clientWidth;
>    innerHeight = document.body.clientHeight;
>    }
>   posX = ((innerWidth - markW)-barW) * (markX/100);
>   posY = ((innerHeight - markH)-barH) * (markY/100);
>   }
> 
> function wRefresh() {
>   wMark.left = posX + (navDOM?pageXOffset:document.body.scrollLeft);
>   wMark.top = posY + (navDOM?pageYOffset:document.body.scrollTop);
>   }
> 
> function markMe() {
>   setVals();
>   window.onresize=setVals;
>   markID = setInterval ("wRefresh()",markRefresh);
>   }
> 
> window.onload=markMe; // safety for Mac IE4.5
> 
> //-->
> </script>
> 
> 
> 
> At 02:20 PM 4/21/2001 +0000, you wrote:
> >If you check out this site (http://www.adobe.com/epaper/main.html), you 
> >will see  in
> >the lower right corner an image (plus to minus to plus to ...). When 
the 
> >window is
> >resized or the user scrolls, the image (on a floating box I presume) 
> >sticks. Does any
> >one have any clues on how to achieve this?
> 

  Return to Index