jquery事件第一次无效,哪位大兄弟遇到过呀

mouseenter click试了好多次了,页面加载第一次点击触发不了,第二次以后就好了,什么情况啊

没有绑定到事件,你是先绑定事件再添加的元素 ,第一次绑定后,你的dom 元素是没有加载的,自然无法绑定事件,等触发第一次后,再次给所有的dom绑定事件的时候,后面的才会绑定,所以你的第一次触发不了,
解决办法就是,绑定事件要等你的元素加载后,再绑定 ,可以使用回掉函数处理 ,

帖代码,看看 ,用的什么浏览器?

    $('.daya').on('mouseout mouseenter','li',function(){
        $('.daya li').on({
            mouseout:function(){
                $(".daya li").eq($(this).index()).find("p").hide();
            },
            mouseenter: function () {
                var index = $(this).index()
                if (index == 5 || index == 6 || index == 12 || index == 13 || index == 19 || index == 20 || index == 26 || index == 27 || index == 33 || index == 34) {
                    $(".daya li").eq(index).find("p").show().addClass("p-left");
                } else if (index == 28 || index == 29 || index == 30 || index == 31 || index == 32) {
                    $(".daya li").eq(index).find("p").show().addClass("p-bottom-r");
                } else if(index==33||index==34){
                    $(".daya li").eq(index).find("p").show().addClass("p-bottom-l");
                }else {
                    $(".daya li").eq(index).find("p").show().addClass("p-right");
                }
            }
        });
    });