這個是我寫的網(wǎng)頁http://tcstory.github.io/hithinksoftdemo/下面描述的內(nèi)容是在打開網(wǎng)頁的情況下,并且不進(jìn)行無關(guān)的操作我用firefox37打開我寫的網(wǎng)頁,cpu占有率,基本上在40%以上,仿寫的網(wǎng)站www.hithinksoft.comcpu占有率才20%左右,如果用chrome42打開我寫的網(wǎng)頁,cpu占有率會飆升到80%左右,但是仿寫的網(wǎng)站才15%左右性能瓶頸到底在哪里呢?補(bǔ)上廣告輪播的關(guān)鍵代碼://-----設(shè)置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,但是還是沒有多大差別我之所以用事件來處理輪播,就是覺得使用事件更能清晰的表達(dá)我的想法,雖然可以通過處理數(shù)組下標(biāo)的方式來完成類似的功能,但是我覺得這樣會使代碼的可讀性不是很好
自己寫的廣告輪播性能太差
慕慕森
2019-04-21 20:22:01