用JTrackBar实现的模拟苹果风格的滚动条_下拉菜单
程序员文章站
2022-04-14 15:30:13
...
复制代码 代码如下:
function JObj(){}
JObj.$c = function(tag){return document.createElement(tag)};
JObj.$ = function(id){return document.getElementById(id)};
JObj.isRate = function(pRateString){
if(!isNaN(pRateString)) return false;
if(pRateString.substr(pRateString.length-1,1) != "%")
return false;
if(isNaN(pRateString.substring(0,pRateString.length - 1)))
return false;
return true;
}
function JPos(){}
JPos.getAbsPos = function(pTarget){
var x_ = y_ = 0;
while(pTarget.offsetParent){
x_ += pTarget.offsetLeft;
y_ += pTarget.offsetTop;
pTarget = pTarget.offsetParent;
}
x_ += pTarget.offsetLeft;
y_ += pTarget.offsetTop;
return {x:x_,y:y_};
}
JPos.getMousePos = function(evt){
var x_ = y_ = 0;
evt = evt || window.event;
if(evt.pageX || evt.pageY){
x_ = evt.pageX;
y_ = evt.pageY;
}else{
x_ = evt.clientX + document.body.scrollLeft - document.body.clientLeft;
y_ = evt.clientY + document.body.scrollTop - document.body.clientTop;
}
return {x:x_,y:y_};
}
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频