JS选项卡之---判断鼠标是移到自己还是选项卡上面

来源:互联网 发布:acrobat dc mac 编辑:程序博客网 时间:2024/05/14 12:28

其实关键就在于

mouseleave里面

判断是移到外面去了,还是移到选项卡里面


//划过时显示$(".risk_m").find(".dd-undeerline")        .mouseenter(function(){            //判断无病症就不显示弹框            var diseasename=$(this).find("p").html();            var _this=$(this)            if(diseasename=='无病症'){                return            }else{                var isDisplay =$(".health-education").css("display");                if(isDisplay=="block"){                    $(".risk_m").find(".dd-undeerline").removeClass("current");                    $(".health-education").hide()                }                $(".risk_m").find(".dd-undeerline").removeClass("current")                $(this).addClass("current");                var borderColor=$(this).css("borderColor").slice(0,17);                var lpos=$(this).offset().left+$(this).width()+ "px";                var tpos=$(".risk_m").offset().top-20+"px";                loaddata(diseasename);                $(".health-education").show();                $(".health-education").css("borderColor",borderColor);                $(".health-education").css({"left":lpos,"top":tpos});            }        })        .mouseleave(function(e){            var e = event || window.event;            var targ = e.target;            var top = $(this).offset();            var x =  e.clientX            var y =  e.clientY            if(top.left-x<-100){                $(".health-education").show()            }else{                $('.risk_m').find('.dd-undeerline').removeClass("current")                $(".health-education").hide()            }        })

0 0
原创粉丝点击