如何在页面首次加载进来的时候也能触发鼠标移动的这个事件
$(function(){
$(".newsbox .tab span").hover(function(){
$(this).addClass("cur").siblings().removeClass("cur");
var index = $(".newsbox .tab span").index(this);
$(".newsbox ul").eq(index).show().siblings().hide();
})
})
trigger下
$(".newsbox .tab span").hover(function(){
$(this).addClass("cur").siblings().removeClass("cur");
var index = $(".newsbox .tab span").index(this);
$(".newsbox ul").eq(index).show().siblings().hide();
}).trigger('hover')
$(function() {
$(".newsbox .tab span").hover(function() {
$(this).addClass("cur").siblings().removeClass("cur");
var index = $(".newsbox .tab span").index(this);
$(".newsbox ul").eq(index).show().siblings().hide();
}).eq(0).trigger('mouseenter');
})
这样就好了,感谢