js实现鼠标移入显示弹框,移出弹框消失


```javascript
layui.use('layer',function(){
    var layer = layui.layer;
    $(function(){
         var tips 
        $('.project').on({                    
            mouseenter:function(){
            var that = this;
            var pj
            this.style.color = 'blue'
            pj = $(this).html()
            datap = {data:{"pj":pj}}
            $.ajax({
                url: "/manage/peopleviewajax",
                type:"get",
                data: datap.data,
                data_type: 'json',
                success:function(res){
                        res = JSON.parse(res)
                        console.log('****',res.data)
                        data = res.data
                        var h = ''
                        for(var i in data){
                            console.log(i)
                            h += ""+i+":"+data[i]+"
" } tips = layer.tips( h, that, {tips:[3,'#fff'],time:0,area: 'auto',maxWidth:1000}) } }); }, mouseleave:function(){ this.style.color='#666' layer.close(tips); } }); }); })

其中,弹框是借助layui中tips模块实现,弹框内容使用ajax动态获取后台数据

你可能感兴趣的:(JS,javascript,js,ajax,python)