蔡邵鑫
蔡邵鑫
  • 发布:2017-12-29 11:37
  • 更新:2017-12-29 14:19
  • 阅读:2679

popover 传值问题

分类:MUI

点击a标签时,怎么把a标签上的属性值传给要弹出来的popover,

<li class="mui-table-view-cell mui-media mui-col-sm-3">  
                <a href="#group_gag" data-id="<%=item.userId%>" data-username="<%=item.username%>">  
                    <img class="group-item-img mui-icon mui-icon-home" src="<%=item.headerPic%>">  
                    <div class="mui-media-body"><%=item.username%></div>  
                </a>  
</li>
        <div id="group_gag" class="mui-popover group-popover">  
            <div class="mui-popover-arrow"></div>  
            <ul class="mui-table-view">  
                <li class="mui-table-view-cell operate-style"><a href="#" id="group-operate">我是谁</a></li>  
                <li class="mui-table-view-cell"><a href="#" name = "group-nogag">我要去哪</a></li>  
                <li class="mui-table-view-cell"><a href="#" name = "group-deleteuser">路在哪里</a></li>  
            </ul>  
        </div>
2017-12-29 11:37 负责人:无 分享
已邀请:
蔡邵鑫

蔡邵鑫 (作者) - 佳人美景,郁上心头

我用js的方法打开

<div id="group_gag" class="mui-popover group-popover">  
            <div class="mui-popover-arrow"></div>  
            <ul class="mui-table-view">  
                <li class="mui-table-view-cell operate-style"><a href="#" id="group-operate">我是谁</a></li>  
                <li class="mui-table-view-cell"><a href="#" name = "group-nogag">我要去哪</a></li>  
                <li class="mui-table-view-cell"><a href="#" name = "group-deleteuser">路在哪里</a></li>  
            </ul>  
        </div>
<li class="mui-table-view-cell mui-media mui-col-sm-3">  
                <a data-id="<%=item.userId%>" data-username="<%=item.username%>"  onclick="openPopover(event)">  
                    <img class="group-item-img mui-icon mui-icon-home" src="<%=item.headerPic%>">  
                    <div class="mui-media-body"><%=item.username%></div>  
                </a>  
</li>
//打开popover  
function openPopover(event) {  
    console.log("openPopover2  ");  
    mui('#group_gag').popover('toggle',document.getElementById("group_gag"));  

}

能顺利打开 也能获取到值 但是 打开的位置不对

我又想动态的去设置坐标

 var posiX = event.pageX || (event.clientX +(document.documentElement.scrollLeft || document.body.scrollLeft));  
    var posiY = event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop));  
    console.log(posiX+"_"+posiY);

可惜没成功,找不到规律去设置

该问题目前已经被锁定, 无法添加新回复