Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - item follows as page is scrolled
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

item follows as page is scrolled

 Post Reply Post Reply
Author
civic3x98 View Drop Down
Newbie
Newbie
Avatar

Joined: 19 December 2003
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote civic3x98 Quote  Post ReplyReply Direct Link To This Post Topic: item follows as page is scrolled
    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

 

Back to Top
tlp2k View Drop Down
Newbie
Newbie


Joined: 15 December 2003
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote tlp2k Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
civic3x98 View Drop Down
Newbie
Newbie
Avatar

Joined: 19 December 2003
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote civic3x98 Quote  Post ReplyReply Direct Link To This Post 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

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>

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.