Jquery CPU usage
Posted
by nharry
on Stack Overflow
See other posts from Stack Overflow
or by nharry
Published on 2010-04-25T12:17:00Z
Indexed on
2010/04/25
12:23 UTC
Read the original article
Hit count: 271
I am using Jquery to make an image scroll across my page horizontally. The only problem is that it uses a serious amount of cpu usage. Up to 100% on a single core laptop in firefox. What could cause this???
Jquery
<script>
jQuery(document).ready(function() {
$(".speech").animate({backgroundPosition: "-6000px 0px"}, 400000, null);
});
</script>
CSS
.speech {
/*position:fixed;*/
top:0;
left:0px;
height:400px;
width:100%;
z-index:-1;
background:url(/images/speech.png) -300px -500px repeat-x;
margin-right: auto;
margin-left: auto;
position: fixed;
}
HTML
<div class="speech"></div>
© Stack Overflow or respective owner