Print Page | Close Window

item follows as page is scrolled

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=8218
Printed Date: 06 April 2026 at 10:58pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: item follows as page is scrolled
Posted By: civic3x98
Subject: item follows as page is scrolled
Date Posted: 19 December 2003 at 7:29am

Hello all,

I have an item on my web page that I want to follow down the web site as I scroll the page. I am pretty sure this is done in either JS or DHTML. I am not sure what it is called so I dont know what to search for. Any help would be great! -Thanks

 




Replies:
Posted By: tlp2k
Date Posted: 19 December 2003 at 8:03am
go to dynamicdrive.com, it should be in the list...or try this one:
http://dynamicdrive.com/dynamicindex1/sm/index.htm




Posted By: civic3x98
Date Posted: 19 December 2003 at 12:47pm

I found one in that list that had the functionality that I was going for. Now my problem lies with some integration.

Below is my code. I am trying to make the scrolling txt float with the page as it scrolls.

Same effect as in this page: http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm - http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm

But replacing the floating item with something like this: http://www.dhtmlshock.com/scrollers/AutoScroll/default.asp

When I try and integrate them together the floating area with the auto-scrolling content sinks to the bottom of the page and you cant get to it.

Any idea?

CODE:

<html>
<head>

<STYLE type="text/css"> 
#divASContainer{position:absolute; width:300; height:300; overflow:hidden; top:600; left:15; clip:rect(0,200,300,0); visibility:hidden; background-color: #FFFFFF}
#divASContent{position:absolute; top:0; left:0; background-color: #ffffff}

</STYLE>
<SCRIPT language="JavaScript">// begin absolutely positioned autoscroll area object scripts

 

function verifyCompatibleBrowser(){
 this.ver=navigator.appVersion
 this.dom=document.getElementById?1:0
 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
 this.ie4=(document.all && !this.dom)?1:0;
 this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
 this.ns4=(document.layers && !this.dom)?1:0;
 this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
 return this
}
bw=new verifyCompatibleBrowser()
lstart=120
loop=true 
speed=50
pr_step=1
function ConstructObject(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
 this.el=bw.dom?document.getElementById(obj):bw.ie4?doc ument.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
   this.css=bw.dom?document.getElementById(obj).style:bw. ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
 this.scrollHeight=bw.ns4?this.css.document.height:this .el.offsetHeight
 this.newsScroll=newsScroll;
 this.moveIt=b_moveIt; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}
function b_moveIt(x,y){
 this.x=x;this.y=y
 this.css.left=this.x
 this.css.top=this.y
}
//Makes the object scroll up
function newsScroll(speed){
 if(this.y>-this.scrollHeight){
  this.moveIt(0,this.y-pr_step)
  setTimeout(this.obj+".newsScroll("+speed+")",spe ed)
 }else if(loop) {
  this.moveIt(0,lstart)
  eval(this.obj+".newsScroll("+speed+")")
   }
}
//Makes the object
function InitialiseAutoScrollArea(){
 objContainer=new ConstructObject('divASContainer')
 objContent=new ConstructObject('divASContent','divASContainer')
 objContent.moveIt(0,lstart)
 objContainer.css.visibility='visible'
 objContent.newsScroll(speed)
}
// end absolutely positioned scrollable area object scripts

</SCRIPT>

 

</head>
<body bgcolor="#ffffff" onLoad="InitialiseAutoScrollArea();">

 


<table border="0" cellpadding="0" cellspacing="0">
  <tr><td><img src="images/main_leftNav.jpg" width="226" height="439"></td></tr>
  <tr><td align="middle">
  
  

 

  
  </td></tr>
</table>
  
  <script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

  <!-- begin absolutely positioned autoscroll area object-->
<DIV id="divASContainer">
  <DIV id="divASContent">
   
  <!--- Includes file containing the title images--->
  <!--#include file="scrolling_quotes_txt.html" -->
  <!--- End --->
 
</DIV>
</DIV>
<!-- end absolutely positioned autoscroll area object -->

</layer>


<script type="text/javascript">

 

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
 var startX = 3,
 startY = 450;
 var ns = (navigator.appName.indexOf("Netscape") != -1);
 var d = document;
 function ml(id)
 {
  var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
  if(d.layers)el.style=el;
  el.sP=function(x,y){this.style.left=x;this.style .top=y;};
  el.x = startX;
  if (verticalpos=="fromtop")
  el.y = startY;
  else{
  el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  el.y -= startY;
  }
  return el;
 }
 window.stayTopLeft=function()
 {
  if (verticalpos=="fromtop"){
  var pY = ns ? pageYOffset : document.body.scrollTop;
  ftlObj.y += (pY + startY - ftlObj.y)/8;
  }
  else{
  var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  ftlObj.y += (pY - startY - ftlObj.y)/8;
  }
  ftlObj.sP(ftlObj.x, ftlObj.y);
  setTimeout("stayTopLeft()", 10);
 }
 ftlObj = ml("divStayTopLeft");
 stayTopLeft();
}
JSFX_FloatTopDiv();
</script>
</body>
</html>




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net