這個是我寫的網頁http://tcstory.github.io/hithinksoftdemo/下面描述的內容是在打開網頁的情況下,并且不進行無關的操作我用firefox37打開我寫的網頁,cpu占有率,基本上在40%以上,仿寫的網站www.hithinksoft.comcpu占有率才20%左右,如果用chrome42打開我寫的網頁,cpu占有率會飆升到80%左右,但是仿寫的網站才15%左右性能瓶頸到底在哪里呢?補上廣告輪播的關鍵代碼://-----設置slides的輪播-----objMap.$slide_items.on('movestart',function(event){$(event.target).fadeIn(configMap.interval_time,function(){$(event.target).trigger('moveend');});});objMap.$slide_items.on('moveend',function(event){if(stateMap.bool_continue){$(this).fadeOut(configMap.interval_time,function(){var_temp=objMap.slide_items.shift();objMap.slide_items.push(_temp);$(objMap.slide_items[0]).trigger('movestart');});}});//-----END-----我試過把fadeIn和fadeOut換成animate,但是還是沒有多大差別我之所以用事件來處理輪播,就是覺得使用事件更能清晰的表達我的想法,雖然可以通過處理數組下標的方式來完成類似的功能,但是我覺得這樣會使代碼的可讀性不是很好
自己寫的廣告輪播性能太差
慕慕森
2019-04-21 20:22:01