Re: page resizing

by "Andrew Armstrong" <andrew(at)wisca.co.uk>

 Date:  Wed, 1 Aug 2001 12:55:02 +0100
 To:  "'Nate Harel '" <nharel(at)consultant.com>,
<hwg-techniques(at)hwg.org>
 References:  rcn
  todo: View Thread, Original
You can move the layer using JavaScript, instead of reloading the page.
Wouldn't that be easier?

Here is how I moved an inner layer within an outer layer that was positioned
in a table cell. This moves a specified distance on a timer function, but it
could easily be adapted to do absolute positioning an a resize event. I
haven't modified it to do this because of the risk of my making a typing
error.

The html code inside the TD:

<div id="out0">
          <div id="Layer1"><img src="images/jenmast_00.gif" width="360"
height="221"></div>
</div>

The stylesheet:

<style type="text/css">
<!--
#out0 { position:relative; width:362px; height:223px}
#Layer1 { position:absolute; width:360px; height:221px;
 left: 1px; top: 1px;
 visibility: visible}
-->


The script:

<script language = "javascript" type="text/javascript">
<!--

//What browser have we here?

bName=navigator.appName;
bVer=parseInt(navigator.appVersion);
if (bName=="Netscape" && bVer>=4) br="NN4";
if (bName=="Microsoft Internet Explorer" && bVer>=4)br="IE4";


// This calls the function that does the move
function moveSplash(){
 var mLeft=179;
 if (br=="IE4") whichEl=document.all.Layer1.style;
 if (br=="NN4") whichEl=document.out0.document.Layer1;
 move(mLeft);
}

function move(xLeft){
 if (xLeft>0){
// move 2 pixels at a time
  a=xLeft-2;
  whichEl.left=xLeft;

  }

  setTimeout("move(a);" ,20);
 }

//-->
</script>




----- Original Message -----
From: "Nate Harel" <nharel(at)consultant.com>
To: "Jim O'Brien" <JObrien(at)witness.com>
Cc: "'Nate Harel '" <nharel(at)consultant.com>; <hwg-techniques(at)hwg.org>
Sent: Wednesday, August 01, 2001 3:25 AM
Subject: RE: page resizing


> Jim,
>
> I actually move a layer about the screen to position it and need to
refresh
> the window in order to do that.
>
>
> Nate
>
>
> At 7/31/2001 08:30 PM, Jim O'Brien wrote:
> >Just for my curiousity...  Why do you need to refresh your window(s) in
IE?
> >The reason there is such a "to do" about the resize script for Netscape
is
> >because there was actually a bug in Netscape that caused a problem when
> >windows were resized.  To my knowledge, this issue does not exist with
> >IE....
> >
> >Thanks in advance for humoring me...
> >-- "the Design Guy"
> >
> >
> >
> >-----Original Message-----
> >From: Nate Harel
> >To: hwg-techniques(at)hwg.org
> >Sent: 7/31/01 3:24 PM
> >Subject: page resizing
> >
> >Hi all,
> >
> >Perhaps I can get a bit of advice on this.
> >
> >I want to refresh a web page when it gets resized.
> >
> >I am using Dreamweaver and they have a little JS routine that does it
> >for
> >Netscape and it works fine. I wanted to implement the same functionality
> >
> >for IE and copied the code and made some minor mods to it. However, the
> >page does not automatically refresh upon resizing. Some
> >ideas/suggestions
> >please.
> >
> >Here is the code and the page it is located on ...
> >
> ><script language="JavaScript">
> >function reloadPage(init) {  //reloads the window if window resized
> >    if (init==true) {
> >      document.pgW=self.innerWidth;
> >         onresize=reloadPage; }
> >    else
> >         if (self.innerWidth!=document.pgW )
> >                 location.reload();
> >}
> >reloadPage(true);
> ></script>
> >
> >
> >http://www.nettech-hosting.net/SeedPartners/index.html
> >
> >
> >Thanks
> >
> >Nate
> >
> >                 ---------------------------------------------------
> >                         Nate Harel
> >                         NetTech Services
> >                         66 Carol Road
> >                   Needham, MA  02492-1108
> >                     Tel: 1-781-559-8176
> >                 Toll Free: 1-877-567-8936
> >                    FAX: 1-877-567-8936
> >                 Email: nharel(at)consultant.com
> >                      www.nettech-services.net
> >                 ----------------------------------------------------
>
>
> ---------------------------------------------------
> Nate Harel
>         NetTech Services
>         66 Carol Road
>   Needham, MA  02492-1108
>     Tel: 1-781-559-8176
> Toll Free: 1-877-567-8936
>    FAX: 1-877-567-8936
> Email: nharel(at)consultant.com
>      www.nettech-services.net
> ----------------------------------------------------
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA