获取鼠标坐标 弹窗位置
作者:chrispy
infoDivXY(event,'.pop-tel-list',true); //获取鼠标坐标 弹窗位置
function infoDivXY (event,div,isHide){
if(!isHide){
$('.info-div').hide();
}
var infoDiv = $(div);
var infoDivHeight = $(div).height();
var infoDivWidth = $(div).width();
var winHeight = $(window).height();
var winWidth = $(window).width();
var pointX = event.pageX;
var pointY = event.pageY;
var gdHeight = 0;
if(url.indexOf('commissionCase.html') > -1){
gdHeight = 240;
}
infoDiv.fadeIn();
infoDiv.css({'left':pointX});
if(winHeight - pointY + gdHeight > infoDivHeight){
infoDiv.css({'top':pointY});
if(winWidth - pointX < infoDivWidth){
infoDiv.css({'bottom':'','top':pointY,'left':'','right':winWidth - pointX})
return false;
}
}else{
infoDiv.css({'top':'','bottom':winHeight - pointY});
if(winWidth - pointX < infoDivWidth){
infoDiv.css({'top':'','left':'','right':winWidth - pointX})
return false;
}
}
}
猜你喜欢
您可能感兴趣的文章:
- SQL TOP 子句
- SQL LIKE 操作符
- SQL 通配符
- SQL IN 操作符
- SQL BETWEEN 操作符
- SQL Alias(别名)
- mysql查询语句 和 多表关联查询 以及 子查询
- thinkphp array_shift() expects parameter 1 to be array, string given
- 一般在调用外部服务请求时候,有时由于配置问题无法访问,phph会报一个php_network_getaddresses: getaddrinfo failed: Name or servicenot known的错误
- python读文件指定行的数据
- SQL HAVING 子句
- Python操作MongoDB
- mysql group by count
- MySQL高性能优化规范、SQL处理、分区表、主主/从复制架构
- python 字符串中只取数字
- phpstorm撤销反撤销
- 如何保证缓存与数据库的双写一致性?
- php json_encode后插入mysql后成乱码
- elasticsearch聚合(sql group by)