smooth scroller

They have: 87 posts

Joined: Dec 2001

i have the following code for making a layer scroll with the page, but how do i make it scroll smoother?

----------------------------------------------
<script>
ie=document.all?1:0
n=document.layers?1:0
var moveOnScroll=true

function checkScrolled(){
divMenu.style.top=eval(scrolled)+150

}
scrolled=n?"window.pageYOffset":"document.body.scrollTop"
if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();
</script>
----------------------------------------------

http://www.newbie-developer.com - Newbie web-developer community.

They have: 33 posts

Joined: Apr 2002

would the css "position" property work? Like

position: fixed

Not sure which browsers this works in though.

They have: 87 posts

Joined: Dec 2001

nope, thats the 1st thing i tried, hoping it would work like bg pics...

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Try reducing the increments -- change 150 to something like 50 and see what happens.

They have: 87 posts

Joined: Dec 2001

Quote: Originally posted by Abhishek Reddy
Try reducing the increments -- change 150 to something like 50 and see what happens.

that just tells how far the layer is from the top of the page so the scoll stays even, changing it still doesn't make it smooth.
i wrote a different script that takes a different approach, but it still is jagged.... look at http://www.korndragon.net

http://www.newbie-developer.com - Newbie web-developer community.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Ehh, should've read it more carefully. Sorry.

If I'm right, the menu is supposed to scroll with the page? On http://www.korndragon.net nothing happens.

They have: 87 posts

Joined: Dec 2001

Quote: Originally posted by Abhishek Reddy
Ehh, should've read it more carefully. Sorry.

If I'm right, the menu is supposed to scroll with the page? On http://www.korndragon.net nothing happens.

on my computer it works... you probably dont use IE4+ huh?

http://www.newbie-developer.com - Newbie web-developer community.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

IE 5.5

They have: 48 posts

Joined: May 2002

Quote: Originally posted by Abhishek Reddy
IE 5.5

Scrolls for me with IE 5.5

They have: 5,633 posts

Joined: Jan 1970

Quote: Originally posted by cadeh
would the css "position" property work? Like

position: fixed

Not sure which browsers this works in though.

Doesn't work in IE5.5 (not sure `bout 6).

To cause a to scroll, set the overflow property to auto

.menu {overflow:auto;}

If the content of the overflows either the x or y axis, a scrolbar will appear.

They have: 48 posts

Joined: May 2002

Quote: Originally posted by cadeh
would the css "position" property work? Like

position: fixed

Not sure which browsers this works in though.

Doesn't work in any browser except latest IE for Mac, according to westciv.com

Mike

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.