JS 获取屏幕点击位置坐标 并 添加icon
.tips {
position: absolute;
z-index: 99;
background: rgba(0,0,0,0.5);
color: #fff;
}
(function ($) {
var $selectedViewList = $('#selectedViewList');
var $tips = $('#J_tips');
$selectedViewList.on('click', function(e) {
$tips = $('<div id="J_tips" class="tips"></div>');
$selectedViewList.append($tips);
var pageX = e.clientX,
pageY = e.clientY;
console.log(pageX,pageY);
$tips.text('这是点击的地方').css({
top: pageY,
left: pageX
});
console.log($tips);
});
})(jQuery);