开发者

JQUERY Causing site to run Slow

I have site with chat built into it. MYSQL, PHP & JQUERY... I'm using setinterval to check for updates - eg: users online, new chat messages etc... I finding users with many chat friends browsers are running very slow... you can hear jquery running over time with the CPU fans etc...

I've done a fair amount of testing and I know the setinterval (every 20 secs), an AJAX call, and the SQL query aren't the problem. The problem is the JQUERY this is executed after this. Know this as I commented out the JQUERY after the DB call and the system ran as expected.

I have about 12 JQUERY functions that run and the problem could be any of them but I wanted to ask if its possible for lots of fadein() and fadeout() on slow time frames could cause the browser to run like a dog. eg: code below

 if(keyArray[1] == 'comment' && $('div#'+keyArray[0]+' h4').text() !== value) {
 $('div#'+keyArray[0]+' h4').fadeOut('slow',function(){
 $('div#'+keyArray[0]+' h4').text(value).css('color','#A0121开发者_运维百科8').fadeIn(4000,function(){
 $('div#'+keyArray[0]+' h4').css('color','#666666');
 });
 });

I have a lot of fadein() and fadeout(), most other ones are using the default slow or fast keywords. Could a large number (lets say 50 to 100) of these trying to run within a 20sec setinterval cause a browser to work overtime?

If the answer is no... thats fine... just wanted to ask... the problem could well be hidden in my code somewhere... debugging continues...

thx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜