codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  floating div in upper corner scrolls infinitely  DaveC426913 at 16:32 on Wednesday, September 05, 2007
 

I have a div that I want to hover in a partular spot on the page, regardless of scrolling.

The script I'm using works great except that in IE, as you scroll down, the page gets longer and longer forever.

I'm looking for a script that does not do this, or a fix to my existing script:


function zxcWWHS(){
if (document.all){
zxcCur='hand';
zxcWH=document.documentElement.clientHeight;
zxcWW=document.documentElement.clientWidth;
zxcWS=document.documentElement.scrollTop;
if (zxcWH==0){
zxcWS=document.body.scrollTop;
zxcWH=document.body.clientHeight;
zxcWW=document.body.clientWidth;
}
}
else if (document.getElementById){
zxcCur='pointer';
zxcWH=window.innerHeight-15;
zxcWW=window.innerWidth-15;
zxcWS=window.pageYOffset;
}
zxcWC=Math.round(zxcWW/2);
return [zxcWW,zxcWH,zxcWS];
}

window.onscroll=function(){
var img=document.getElementById('floatinggallery');
if (!document.all){ img.style.position='fixed'; window.onscroll=null; return; }
if (!img.pos){ img.pos=img.offsetTop; }
img.style.top=(zxcWWHS()[2]+img.pos)+'px';
}


(Frankly I'm not even sure how this script works.)










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  mkdirs
•  Re: Web Development Project
•  ** Site Hacked ** javascript inserted...
•  Losing background/text color when converting HTML to PDF
•  hidden div block when displayed, displays at an offset of 200px only in IE 6..
•  help - sketch
•  Re: Perl Script - File Handling.
•  Open a file from website
•  Re: to open 5 terminals from one and also execute different commands on each terminal


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008