📄 slider.js
字号:
Class("linb.UI.Slider", ["linb.UI","linb.absValue"],{
Instance:{
_setCtrlValue:function(value){
return this.each(function(profile){
var p=profile.properties,
steps=p.steps,
fun=function(k){return profile.getSubNode(k)},
a=fun('IND1'),
b=fun('IND2'),
arr = profile.box._v2a(profile,value),
ori=p.type=='vertical'?'top':'left';
a[ori](arr[0]+'%');
if(p.isRange)
b[ori](arr[1]+'%');
});
},
_setDirtyMark:function(){
return this.each(function(profile){
if(!profile.properties.dirtyMark)return;
if(!profile.domNode)return;
var properties = profile.properties,
flag=properties.value !== properties.$UIvalue;
if(profile._dirtyFlag==flag)return;
profile._dirtyFlag=flag;
var o=profile.getSubNode('BOX'),
cls=linb.UI.$css_tag_dirty;
if(profile.beforeDirtyMark && false===profile.boxing().beforeDirtyMark(profile,flag))
return;
if(flag)
o.addClass(cls);
else
o.removeClass(cls);
});
}
},
Static:{
Templates:{
style:'{_style}',
BOX:{
tagName:'div',
className:'{_cls}',
BG:{
tagName:'div'
},
RULER:{
$order:1,
tagName:'div',
RULERLEFT:{},
RULERRIGHT:{}
},
IND:{
$order:2,
IND1:{
tagName:'a',
style:'{_showD}',
href:linb.$href,
tabindex:'{tabIndex}'
},
IND2:{
tagName:'a',
href:linb.$href,
tabindex:'{tabIndex}',
style:'{_showD2}'
}
},
DECREASE:{
tagName:'a',
style:'{_showDes}',
href:linb.$href,
tabindex:'{tabIndex}'
},
INCREASE:{
tagName:'a',
style:'{_showIns}',
href:linb.$href,
tabindex:'{tabIndex}'
}
}
},
Appearances:{
'IND, BT, RULER, RULERLEFT, RULERRIGHT, IND1, IND2, DECREASE, INCREASE':{
'font-size':0,
'line-height':0,
position:'absolute'
},
BOX:{
position:'relative',
left:0,
top:0,
width:'100%',
height:'100%'
},
'BOX-h DECREASE, BOX-h INCREASE':{
top:'50%',
width:'17px',
height:'17px',
'margin-top':'-8px'
},
'BOX-v DECREASE, BOX-v INCREASE, BOX-h DECREASE, BOX-h INCREASE, BOX-h IND1,BOX-h IND2, BOX-v IND1,BOX-v IND2':{
background: linb.UI.$bg('icons.gif', 'no-repeat',true)
},
'BOX-h DECREASE':{
$order:1,
left:0,
'background-position': '-80px -70px'
},
'BOX-h INCREASE':{
$order:1,
right:0,
'background-position': '-100px -70px'
},
'BOX-h DECREASE-mouseover':{
$order:2,
'background-position':'-80px -90px'
},
'BOX-h DECREASE-mousedown':{
$order:3,
'background-position':'-80px -110px'
},
'BOX-h INCREASE-mouseover':{
$order:2,
'background-position':'-100px -90px'
},
'BOX-h INCREASE-mousedown':{
$order:3,
'background-position':'-100px -110px'
},
'BOX-h BG':{
top:'50%'
},
'BOX-h IND, BOX-h RULER':{
'z-index':1,
top:'50%',
height:'6px',
'margin-top':'-3px'
},
'BOX-h RULER, BOX-h RULERLEFT, BOX-h RULERRIGHT':{
background: linb.UI.$bg('bar_vertical.gif', 'repeat-x',true)
},
'BOX-h RULER':{
$order:2,
'background-position':'left -482px'
},
'BOX-h RULERLEFT, BOX-h RULERRIGHT':{
'z-index':1,
height:'6px',
width:'5px'
},
'BOX-h RULERLEFT':{
$order:2,
'background-position':'left -474px',
left:'-4px',
top:0
},
'BOX-h RULERRIGHT':{
$order:2,
'background-position':'left -490px',
right:'-4px',
top:0
},
'BOX-h IND1,BOX-h IND2':{
$order:1,
'z-index':2,
'background-position': '-21px -282px',
height:'18px',
width:'8px',
left:0,
top:0,
'margin-top':'-6px'
},
'BOX-h IND1-mouseover,BOX-h IND2-mouseover':{
$order:2,
'background-position':'-31px -282px'
},
'BOX-h IND1-mousedown,BOX-h IND2-mousedown':{
$order:3,
'background-position':'-41px -282px'
},
'BOX-v DECREASE, BOX-v INCREASE':{
$order:10,
left:'50%',
width:'17px',
height:'17px',
'margin-left':'-8px'
},
'BOX-v DECREASE':{
$order:10,
top:0,
'background-position': '-120px -70px'
},
'BOX-v INCREASE':{
$order:10,
bottom:0,
'background-position': '-140px -70px'
},
'BOX-v DECREASE-mouseover':{
$order:11,
'background-position':'-120px -90px'
},
'BOX-v DECREASE-mousedown':{
$order:12,
'background-position':'-120px -110px'
},
'BOX-v INCREASE-mouseover':{
$order:11,
'background-position':'-140px -90px'
},
'BOX-v INCREASE-mousedown':{
$order:12,
'background-position':'-140px -110px'
},
'BOX-v BG':{
$order:10,
left:'50%'
},
'BOX-v IND, BOX-v RULER':{
$order:10,
'z-index':1,
left:'50%',
width:'6px',
'margin-left':'-3px'
},
'BOX-v RULER, BOX-v RULERLEFT, BOX-v RULERRIGHT':{
background: linb.UI.$bg('bar_horizontal.gif', 'repeat-y',true)
},
'BOX-v RULER':{
$order:10,
'background-position':'-482px top'
},
'BOX-v RULERLEFT, BOX-v RULERRIGHT':{
$order:10,
'z-index':1,
width:'6px',
height:'5px'
},
'BOX-v RULERLEFT':{
$order:12,
'background-position':'-490px top',
top:'-4px',
left:0
},
'BOX-v RULERRIGHT':{
$order:12,
'background-position':'-474px top',
bottom:'-4px',
left:0
},
'BOX-v IND1,BOX-v IND2':{
$order:10,
'z-index':2,
'background-position': 'left -272px',
width:'18px',
height:'8px',
left:0,
top:0,
'margin-left':'-6px'
},
'BOX-v IND1-mouseover,BOX-v IND2-mouseover':{
$order:11,
'background-position':'left -282px'
},
'BOX-v IND1-mousedown,BOX-v IND2-mousedown':{
$order:12,
'background-position':'left -292px'
}
},
Behaviors:{
HoverEffected:{IND1:'IND1',IND2:'IND2',DECREASE:'DECREASE',INCREASE:'INCREASE'},
ClickEffected:{IND1:'IND1',IND2:'IND2',DECREASE:'DECREASE',INCREASE:'INCREASE'},
onSize:function(profile,e){
var o = profile.root;
linb.UI.$tryResize(profile, e.width?o.width():null, o.height?o.height():null);
},
IND:{
onClick:function(profile, e, src){
var p=profile.properties,
p1=linb([src]).offset(),
p2=linb.Event.getPos(e),
arr=profile.box._v2a(profile,profile.properties.$UIvalue),
i1,i2,
type=p.type=='vertical',
k1=type?'top':'left',
k2=type?'offsetTop':'offsetLeft',
k3=type?'offsetHeight':'offsetWidth',
cur=p2[k1]-p1[k1],
v=(cur/src[k3])*100;
if(!p.isRange)
arr[0]=v;
else{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -