Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Is there any method I can avoid the falter when i scroll down the scrollbar

Reply
Thread Tools

Is there any method I can avoid the falter when i scroll down the scrollbar

 
 
jidixuelang@gmail.com
Guest
Posts: n/a
 
      07-19-2007
Hi all!

I create a div ,which i wish can stay top alway?I user onscroll to
simulate this.

But let me desponding,when scroll down the scrollbar,i can see the div
is faltering distinctly!

Is there any method I can use to avoid the falter?

Please look the following code:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html,body{ margin:0;}
#topDiv {
width:100%;
height:80px;
background:#ccc;
color:#fff;
font-size:24px;
font-weight:bold;
text-align:center;
}
</style>
</head>

<body>
<div id="topDiv">Is there any method I can avoid the falter when i
scroll down the scrollbar?</div>
<script type="text/javascript">
function autoScrollDiv(id){
this.dbody = document.getElementById(id);
with(this.dbody.style){
position= "absolute";
top     = "0";
left    = "0";
}
var control = this.dbody;
window.onscroll	=  function(){
var posY = document.documentElement.scrollTop ||
document.body.scrollTop;
control.style.top = posY + "px";
}
}
/*
autoScrollDiv.prototype = {
autoScroll:function(){
var posY = document.documentElement.scrollTop ||
document.body.scrollTop;
this.dbody.style.top = posY + "px";
}
}
*/
var a = new autoScrollDiv("topDiv");
</script>

<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /
><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /
><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /
><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /
><br /><br /><br />
</body>
</html>
 
Reply With Quote
 
 
 
 
jidixuelang@gmail.com
Guest
Posts: n/a
 
      07-20-2007
THX David!
It only jitter "if lt IE 7",now!Great!
But i ever see this effect in a website(http://blog.163.com/,you may
see that in top left when you login.test
username:avoidthefalter,password:aaa111 [number 1 not char l]) .
I discover its code just like my write!
But i didn't see the jitter in IE6,when i visit that website.

 
Reply With Quote
 
 
 
 
David Mark
Guest
Posts: n/a
 
      07-21-2007
On Jul 19, 8:26 pm, "jidixuel...@gmail.com" <jidixuel...@gmail.com>
wrote:
> THX David!
> It only jitter "if lt IE 7",now!Great!
> But i ever see this effect in a website(http://blog.163.com/,youmay
> see that in top left when you login.test
> username:avoidthefalter,password:aaa111 [number 1 not char l]) .
> I discover its code just like my write!
> But i didn't see the jitter in IE6,when i visit that website.


I don't know how that could be. Are you sure they weren't creating
scrollable DIV's or using Flash or some other nonsense. I can't make
heads or tails of that site as I don't have the required fonts (or
Flash) installed.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Scroll up and scroll down in CR-report Sathiamoorthy ASP .Net 1 11-28-2006 11:42 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Using a div with scroll bars - can we get the scroll bars on the left instead of the right side? UJ ASP .Net 1 11-01-2006 09:32 PM
Can't scroll horizontal scrollbar Kurt Underhay Java 1 04-11-2005 05:03 PM
ScrollBar? Does it exist just WEB ScrollBar Control? Alex ASP .Net Web Controls 1 04-04-2004 12:44 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57