无为清净楼资源网 Design By www.qnjia.com
<!--
/*
----------------------------------------------------------------------
JTrackBar
初始日期:2007/07/11
Author:xlingFairy
Blog:http://xling.blueidea.com
目前只能生水平的,垂直的还没有写。
设计功能:
当改变时,触发事件onChange,并传当前值。
2007/07/12
加入拖动功能。
2007/07/13
加入皮肤功能
未做功能:指定trackFrequence,你可以自己试着修改一下。
请尊重劳动成果!不得删除原作都信息!后果自负!
----------------------------------------------------------------------
*/
function JPos(){
}
JPos.getAbsPos = function(pTarget){
var _x = 0;
var _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;
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};
}
function JTrackBar(pParent){
var self = this;
var $ = function(pId){
return document.getElementById(pId);
}
var $c = function(pTag){
return document.createElement(pTag);
}
var body = $(pParent) || document.body;
var oOutline = null;
var oTrackArea = null;
var oBtnPointer = null;
var oArrBtnLeft = oArrBtnRight = oArrBtnUp = oArrBtnDown = null;
var inDrag = false;
var dragStartPos = null;
var maxPosition = 100; //最大刻度
var minPosition = 0; //最小刻度
var position = 0; //当前位置
var trackFrequence = 10; //点击一次移动多少刻度
this.setRange = function(pMin,pMax){
maxPosition = Math.max(pMin,pMax);
minPosition = Math.min(pMin,pMax);
}
var outlineWidth,trackAreaWidth,preFrequenceWidth;
this.onChange = new Function();
var getRunStyle = function(pObj,pProperty){
try{
if(pObj.currentStyle)
return eval("pObj.currentStyle." + pProperty);
else
return document.defaultView.getComputedStyle(pObj,"").getPropertyValue(pProperty);
}catch(e){
alert(e);
}
}
/*-----------------------------------------------------*/
var createOutline = function(pWidth){
oOutline = $c("DIV");
body.appendChild(oOutline);
oOutline.className = "JTrackBarStand";
oOutline.style.width = pWidth + "px";
//oOutline.style.height = "15px";
oOutline.style.overflow = "hidden";
}
/*-----------------------------------------------------*/
var createArrBtn = function(pDirection){
var arrBtn = $c("DIV");
switch(pDirection){
case "LEFT":
arrBtn.className = "btnLeft";
arrBtn.style.styleFloat = "left";
arrBtn.style.cssFloat = "left";
break;
case "RIGHT":
arrBtn.className = "btnRight";
arrBtn.style.styleFloat = "left";
arrBtn.style.cssFloat = "left";
break;
case "UP":
arrBtn.className = "btnUp";
break;
case "DOWN":
arrBtn.className = "btnDown";
break;
}
arrBtn.direction = pDirection;
arrBtn.onclick = arrBtn_click;
return arrBtn;
}
var arrBtn_click = function(evt){
evt = window.event || evt;
var o = evt.srcElement || evt.target;
switch(o.direction){
case "LEFT":
if(position <= minPosition)
return;
self.setPositionBy( -trackFrequence);
break;
case "RIGHT":
if(position >= maxPosition)
return;
self.setPositionBy(trackFrequence);
break;
}
}
var trackarea_click = function(evt){
evt = window.event || evt;
var mPos = JPos.getMousePos(evt);
var pos_ = JPos.getAbsPos(oTrackArea);
var w_ = parseInt(getRunStyle(oBtnPointer,"width"));
self.setPosition(parseInt((mPos.x - pos_.x) / preFrequenceWidth));
}
var createHTrackArea = function(){
var w_ = parseInt(getRunStyle(oArrBtnLeft,"width"));
trackAreaWidth = outlineWidth - 2 * w_;
preFrequenceWidth = trackAreaWidth / (maxPosition - minPosition);
oTrackArea = $c("DIV");
oOutline.appendChild(oTrackArea);
oTrackArea.onclick = trackarea_click;
oTrackArea.className = "trackArea";
oTrackArea.style.width = trackAreaWidth + "px";
oTrackArea.style.styleFloat = "left";
oTrackArea.style.cssFloat = "left";
}
var recalcTrackArea = function(){
var w_ = parseInt(getRunStyle(oArrBtnLeft,"width"));
trackAreaWidth = outlineWidth - 2 * w_;
preFrequenceWidth = trackAreaWidth / (maxPosition - minPosition);
oTrackArea.style.width = trackAreaWidth + "px";
}
var pointer_mousedown = function(evt){
inDrag = true;
dragStartPos = JPos.getMousePos(evt);
body.onmousemove = pointer_mousemove;
body.onmouseup = pointer_mouseup;
body.onmouseout = pointer_mouseout;
}
var pointer_mousemove = function(evt){
if(!inDrag) return;
//evt = window.event || evt;
//var x_ = evt.clientX;
//window.status = x_ + " " + dragStartPos.x;
//self.setPositionBy(x_ - dragStartPos.x);
//window.status += " " + evt.clientX;
var mPos = JPos.getMousePos(evt);
var pos_ = JPos.getAbsPos(oTrackArea);
self.setPosition(parseInt((mPos.x - pos_.x) / preFrequenceWidth));
}
var pointer_mouseup = function(){
inDrag = false;
}
var pointer_mouseout = function(){
//inDrag = false;
}
var createHPointer = function(){
oBtnPointer = $c("DIV");
oOutline.appendChild(oBtnPointer);
//oBtnPointer.onclick = trackarea_click;
oBtnPointer.onmousedown = pointer_mousedown;
//oOutline.onmousemove = oBtnPointer.onmousemove = pointer_mousemove;
//oBtnPointer.onmouseup = pointer_mouseup;
//oBtnPointer.onmouseout = pointer_mouseout;
oBtnPointer.className = "btnPointer";
oBtnPointer.style.position = "absolute";
var w_ = parseInt(getRunStyle(oBtnPointer,"width"));
var pos_ = JPos.getAbsPos(oTrackArea);
oBtnPointer.style.left = pos_.x - w_/2 + "px";
oBtnPointer.style.top = pos_.y + "px";
oBtnPointer.style.cssText += "left:" + (pos_.x - w_/2) + "px;top:" + pos_.y + "px;";
}
/*-----------------------------------------------------*/
this.createHTrackBar = function(pWidth){
outlineWidth = pWidth;
createOutline(pWidth);
oArrBtnLeft = createArrBtn("LEFT");
oOutline.appendChild(oArrBtnLeft);
createHTrackArea();
oArrBtnRight = createArrBtn("RIGHT");
oOutline.appendChild(oArrBtnRight);
createHPointer();
}
/*-----------------------------------------------------*/
this.setPositionBy = function(pPosition){
position += pPosition;
self.setPosition(position);
}
this.setPosition = function(pPosition){
position = pPosition;
if(position > maxPosition)
position = maxPosition;
if(position < minPosition)
position = minPosition;
var pos_ = JPos.getAbsPos(oTrackArea);
var w_ = parseInt(getRunStyle(oBtnPointer,"width"));
oBtnPointer.style.left = pos_.x - w_/2 + preFrequenceWidth * position + "px";
doChange();
}
var doChange = function(){
self.onChange(position);
}
this.getPosition = function(){
return position;
}
this.setSkin = function(pSkin){
oOutline.className = pSkin;
recalcTrackArea();
}
}
打包文件下载
/*
----------------------------------------------------------------------
JTrackBar
初始日期:2007/07/11
Author:xlingFairy
Blog:http://xling.blueidea.com
目前只能生水平的,垂直的还没有写。
设计功能:
当改变时,触发事件onChange,并传当前值。
2007/07/12
加入拖动功能。
2007/07/13
加入皮肤功能
未做功能:指定trackFrequence,你可以自己试着修改一下。
请尊重劳动成果!不得删除原作都信息!后果自负!
----------------------------------------------------------------------
*/
function JPos(){
}
JPos.getAbsPos = function(pTarget){
var _x = 0;
var _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;
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};
}
function JTrackBar(pParent){
var self = this;
var $ = function(pId){
return document.getElementById(pId);
}
var $c = function(pTag){
return document.createElement(pTag);
}
var body = $(pParent) || document.body;
var oOutline = null;
var oTrackArea = null;
var oBtnPointer = null;
var oArrBtnLeft = oArrBtnRight = oArrBtnUp = oArrBtnDown = null;
var inDrag = false;
var dragStartPos = null;
var maxPosition = 100; //最大刻度
var minPosition = 0; //最小刻度
var position = 0; //当前位置
var trackFrequence = 10; //点击一次移动多少刻度
this.setRange = function(pMin,pMax){
maxPosition = Math.max(pMin,pMax);
minPosition = Math.min(pMin,pMax);
}
var outlineWidth,trackAreaWidth,preFrequenceWidth;
this.onChange = new Function();
var getRunStyle = function(pObj,pProperty){
try{
if(pObj.currentStyle)
return eval("pObj.currentStyle." + pProperty);
else
return document.defaultView.getComputedStyle(pObj,"").getPropertyValue(pProperty);
}catch(e){
alert(e);
}
}
/*-----------------------------------------------------*/
var createOutline = function(pWidth){
oOutline = $c("DIV");
body.appendChild(oOutline);
oOutline.className = "JTrackBarStand";
oOutline.style.width = pWidth + "px";
//oOutline.style.height = "15px";
oOutline.style.overflow = "hidden";
}
/*-----------------------------------------------------*/
var createArrBtn = function(pDirection){
var arrBtn = $c("DIV");
switch(pDirection){
case "LEFT":
arrBtn.className = "btnLeft";
arrBtn.style.styleFloat = "left";
arrBtn.style.cssFloat = "left";
break;
case "RIGHT":
arrBtn.className = "btnRight";
arrBtn.style.styleFloat = "left";
arrBtn.style.cssFloat = "left";
break;
case "UP":
arrBtn.className = "btnUp";
break;
case "DOWN":
arrBtn.className = "btnDown";
break;
}
arrBtn.direction = pDirection;
arrBtn.onclick = arrBtn_click;
return arrBtn;
}
var arrBtn_click = function(evt){
evt = window.event || evt;
var o = evt.srcElement || evt.target;
switch(o.direction){
case "LEFT":
if(position <= minPosition)
return;
self.setPositionBy( -trackFrequence);
break;
case "RIGHT":
if(position >= maxPosition)
return;
self.setPositionBy(trackFrequence);
break;
}
}
var trackarea_click = function(evt){
evt = window.event || evt;
var mPos = JPos.getMousePos(evt);
var pos_ = JPos.getAbsPos(oTrackArea);
var w_ = parseInt(getRunStyle(oBtnPointer,"width"));
self.setPosition(parseInt((mPos.x - pos_.x) / preFrequenceWidth));
}
var createHTrackArea = function(){
var w_ = parseInt(getRunStyle(oArrBtnLeft,"width"));
trackAreaWidth = outlineWidth - 2 * w_;
preFrequenceWidth = trackAreaWidth / (maxPosition - minPosition);
oTrackArea = $c("DIV");
oOutline.appendChild(oTrackArea);
oTrackArea.onclick = trackarea_click;
oTrackArea.className = "trackArea";
oTrackArea.style.width = trackAreaWidth + "px";
oTrackArea.style.styleFloat = "left";
oTrackArea.style.cssFloat = "left";
}
var recalcTrackArea = function(){
var w_ = parseInt(getRunStyle(oArrBtnLeft,"width"));
trackAreaWidth = outlineWidth - 2 * w_;
preFrequenceWidth = trackAreaWidth / (maxPosition - minPosition);
oTrackArea.style.width = trackAreaWidth + "px";
}
var pointer_mousedown = function(evt){
inDrag = true;
dragStartPos = JPos.getMousePos(evt);
body.onmousemove = pointer_mousemove;
body.onmouseup = pointer_mouseup;
body.onmouseout = pointer_mouseout;
}
var pointer_mousemove = function(evt){
if(!inDrag) return;
//evt = window.event || evt;
//var x_ = evt.clientX;
//window.status = x_ + " " + dragStartPos.x;
//self.setPositionBy(x_ - dragStartPos.x);
//window.status += " " + evt.clientX;
var mPos = JPos.getMousePos(evt);
var pos_ = JPos.getAbsPos(oTrackArea);
self.setPosition(parseInt((mPos.x - pos_.x) / preFrequenceWidth));
}
var pointer_mouseup = function(){
inDrag = false;
}
var pointer_mouseout = function(){
//inDrag = false;
}
var createHPointer = function(){
oBtnPointer = $c("DIV");
oOutline.appendChild(oBtnPointer);
//oBtnPointer.onclick = trackarea_click;
oBtnPointer.onmousedown = pointer_mousedown;
//oOutline.onmousemove = oBtnPointer.onmousemove = pointer_mousemove;
//oBtnPointer.onmouseup = pointer_mouseup;
//oBtnPointer.onmouseout = pointer_mouseout;
oBtnPointer.className = "btnPointer";
oBtnPointer.style.position = "absolute";
var w_ = parseInt(getRunStyle(oBtnPointer,"width"));
var pos_ = JPos.getAbsPos(oTrackArea);
oBtnPointer.style.left = pos_.x - w_/2 + "px";
oBtnPointer.style.top = pos_.y + "px";
oBtnPointer.style.cssText += "left:" + (pos_.x - w_/2) + "px;top:" + pos_.y + "px;";
}
/*-----------------------------------------------------*/
this.createHTrackBar = function(pWidth){
outlineWidth = pWidth;
createOutline(pWidth);
oArrBtnLeft = createArrBtn("LEFT");
oOutline.appendChild(oArrBtnLeft);
createHTrackArea();
oArrBtnRight = createArrBtn("RIGHT");
oOutline.appendChild(oArrBtnRight);
createHPointer();
}
/*-----------------------------------------------------*/
this.setPositionBy = function(pPosition){
position += pPosition;
self.setPosition(position);
}
this.setPosition = function(pPosition){
position = pPosition;
if(position > maxPosition)
position = maxPosition;
if(position < minPosition)
position = minPosition;
var pos_ = JPos.getAbsPos(oTrackArea);
var w_ = parseInt(getRunStyle(oBtnPointer,"width"));
oBtnPointer.style.left = pos_.x - w_/2 + preFrequenceWidth * position + "px";
doChange();
}
var doChange = function(){
self.onChange(position);
}
this.getPosition = function(){
return position;
}
this.setSkin = function(pSkin){
oOutline.className = pSkin;
recalcTrackArea();
}
}
打包文件下载
标签:
JTrackBar水平拖动效果
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 秀兰玛雅.1999-友情人【大旗】【WAV+CUE】
- 小米.2020-我想在城市里当一个乡下人【滚石】【FLAC分轨】
- 齐豫.2003-THE.UNHEARD.OF.CHYI.3CD【苏活音乐】【WAV+CUE】
- 黄乙玲1986-讲什么山盟海誓[日本东芝版][WAV+CUE]
- 曾庆瑜1991-柔情陷阱[台湾派森东芝版][WAV+CUE]
- 陈建江《享受男声》DTS-ES6.1【WAV】
- 群星《闪光的夏天 第5期》[FLAC/分轨][392.38MB]
- 徐小凤《三洋母带》1:1母盘直刻[WAV+CUE][981M]
- 王菲1995《菲靡靡之音》[香港首版][WAV+CUE][1G]
- 《双城之战》主题小游戏现已上线 扮演金克丝探索秘密基地
- 《霍格沃茨之遗》PS5Pro画面对比:光追性能显著提升
- 《怪猎荒野》PS5Pro主机版对比:B测性能都不稳定
- 黄宝欣.1992-黄宝欣金装精选2CD【HOMERUN】【WAV+CUE】
- 群星.1996-宝丽金流行爆弹精丫宝丽金】【WAV+CUE】
- 杜德伟.2005-独领风骚新歌精选辑3CD【滚石】【WAV+CUE】