结合Extjs tree做的.
//有消息头像跳动 function jumpyIcon(id, duration){ var node = Ext.getCmp('chat-linkmanTree').getNodeById(id); if(node){ if(isNaN(duration))duration = 800; var iconEl = node.ui.getIconEl(); var textEl = node.ui.getTextEl(); var handler = window.setInterval(function(){ if(node.attributes.flashX == 'x'){//是否跳动的标志 iconEl.style.marginLeft = "5px"; textEl.style.marginLeft = "3px"; } window.setTimeout(function(){ iconEl.style.marginLeft = ""; textEl.style.marginLeft = ""; if(node.attributes.flashX != 'x'){return;} },duration/2); }, duration); } };