需求是:页面一加载立马触发hover事件问题点:使用trigger无法触发hover事件解决方案:使用mouseenter进行替换即可 $(function(){ $("#code").trigger("mouseenter") })