1
2 |
< script type = "text/javascript" src = "JavaScript/jquery1.7.2.js" ></ script > < script type = "text/javascript" src = "JavaScript/Tdrag.js" ></ script > |
1 |
< div class = "div1" ></ div > |
1 |
$( ".div1" ).Tdrag(); |
1
2
3 |
< div class = "boxList" > < div class = "div3" ></ div > </ div > |
1
2
3 |
$( ".div3" ).Tdrag({ scope: ".boxList" }); |
1
2
3 |
< div class = "boxList" > < div class = "div4" ></ div > </ div > |
1
2
3
4
5 |
$( ".div4" ).Tdrag({ scope: ".boxList" , grid:[50,50] }); |
1
2
3
4 |
< div class = "boxList" > < div class = "one onlyX" ></ div > < div class = "one onlyY" ></ div > </ div > |
1
2
3
4
5
6
7
8 |
$( ".onlyX" ).Tdrag({ scope: ".boxList" , axis: "x" }); $( ".onlyY" ).Tdrag({ scope: ".boxList" , axis: "y" }); |
1 |
< div class = "one div5" ></ div > |
1
2
3 |
$( ".div5" ).Tdrag({ pos: true }); |
1
2
3
4
5 |
< div class = "boxList" > < div class = "one div6" > < div class = "title" >title</ div > </ div > </ div > |
1
2
3
4 |
$( ".div6" ).Tdrag({ scope: ".boxList" , handle: ".title" }); |
1
2
3
4
5
6
7
8
9 |
< div class = "boxList" > < div class = "one div7" > </ div > < div > start:< p class = "start" >0</ p > move:< p class = "move" >0</ p > end:< p class = "end" >0</ p > </ div > </ div > |
1
2
3
4
5
6 |
$( ".div7" ).Tdrag({ scope: ".boxList" , cbStart: function (){$( ".start" ).html(Number($( ".start" ).html())+1)}, //移动前的回调函数 cbMove: function (){$( ".move" ).html(Number($( ".move" ).html())+1)}, //移动中的回调函数 cbEnd: function (){$( ".end" ).html(Number($( ".end" ).html())+1)} //移动结束时候的回调函数 }); |
0
move:0
end:0
1
2
3
4
5
6
7
8
9
10
11
12 |
< div class = "boxList" > < div class = "one div8" >< div class = "title" >1</ div ></ div > < div class = "one div8" >< div class = "title" >2</ div ></ div > < div class = "one div8" >< div class = "title" >3</ div ></ div > < div class = "one div8" >< div class = "title" >4</ div ></ div > < div class = "one div8" >< div class = "title" >5</ div ></ div > < div class = "one div8" >< div class = "title" >6</ div ></ div > < div class = "one div8" >< div class = "title" >7</ div ></ div > < div class = "one div8" >< div class = "title" >8</ div ></ div > < div class = "one div8" >< div class = "title" >9</ div ></ div > < div class = "one div8" >< div class = "title" >10</ div ></ div > </ div > |
1
2
3
4
5 |
$( ".div8" ).Tdrag({ scope: ".boxList" , pos: true , dragChange: true }); |
1
2
3
4
5
6
7
8
9
10
11
12 |
< div class = "boxList" > < div class = "one div9" >< div class = "title" >1</ div ></ div > < div class = "one div9" >< div class = "title" >2</ div ></ div > < div class = "one div9" >< div class = "title" >3</ div ></ div > < div class = "one div9" >< div class = "title" >4</ div ></ div > < div class = "one div9" >< div class = "title" >5</ div ></ div > < div class = "one div9" >< div class = "title" >6</ div ></ div > < div class = "one div9" >< div class = "title" >7</ div ></ div > < div class = "one div9" >< div class = "title" >8</ div ></ div > < div class = "one div9" >< div class = "title" >9</ div ></ div > < div class = "one div9" >< div class = "title" >10</ div ></ div > </ div > |
1
2
3
4
5
6 |
$( ".div9" ).Tdrag({ scope: ".boxList" , pos: true , dragChange: true , changeMode: "sort" }); |
1
2
3
4
5
6
7 |
< div class = "boxList" > < div class = "one div10" >< div class = "title" >1</ div ></ div > < div class = "one div10" >< div class = "title" >2</ div ></ div > < div class = "one div10" >< div class = "title" >3</ div ></ div > < div class = "one div10" >< div class = "title" >4</ div ></ div > < div class = "one div10" >< div class = "title" >5</ div ></ div > </ div > |
1
2
3
4
5
6
7 |
$( ".div10" ).Tdrag({ scope: ".boxList" , pos: true , dragChange: true , changeMode: "sort" , moveClass: "abc" }); |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 |
< input class = "plug_random" type = "button" value = "通过插件随机" > < input class = "fn_random" type = "button" value = "通过函数随机" > < div class = "boxList" > < div class = "one div11" >< div class = "title" >1</ div ></ div > < div class = "one div11" >< div class = "title" >2</ div ></ div > < div class = "one div11" >< div class = "title" >3</ div ></ div > < div class = "one div11" >< div class = "title" >4</ div ></ div > < div class = "one div11" >< div class = "title" >5</ div ></ div > < div class = "one div11" >< div class = "title" >6</ div ></ div > < div class = "one div11" >< div class = "title" >7</ div ></ div > < div class = "one div11" >< div class = "title" >8</ div ></ div > < div class = "one div11" >< div class = "title" >9</ div ></ div > < div class = "one div11" >< div class = "title" >10</ div ></ div > < div class = "one div11" >< div class = "title" >11</ div ></ div > < div class = "one div11" >< div class = "title" >12</ div ></ div > < div class = "one div11" >< div class = "title" >13</ div ></ div > < div class = "one div11" >< div class = "title" >14</ div ></ div > < div class = "one div11" >< div class = "title" >15</ div ></ div > </ div > |
1
2
3
4
5
6
7
8
9
10 |
$( ".div11" ).Tdrag({ scope: ".boxList" , pos: true , dragChange: true , random: true , randomInput: ".plug_random" }); $( ".fn_random" ).on( "click" , function (){ $.randomfn( ".div11" ) }) |
1
2
3
4
5
6
7
8
9
10
11
12 |
< div class = "boxList" > < div class = "one div12" >< div class = "title" >1</ div ></ div > < div class = "one div12" >< div class = "title" >2</ div ></ div > < div class = "one div12" >< div class = "title" >3</ div ></ div > < div class = "one div12" >< div class = "title" >4</ div ></ div > < div class = "one div12" >< div class = "title" >5</ div ></ div > < div class = "one div12" >< div class = "title" >6</ div ></ div > < div class = "one div12" >< div class = "title" >7</ div ></ div > < div class = "one div12" >< div class = "title" >8</ div ></ div > < div class = "one div12" >< div class = "title" >9</ div ></ div > < div class = "one div12" >< div class = "title" >10</ div ></ div > </ div > |
1
2
3
4
5
6
7
8
9 |
$( ".div12" ).Tdrag({ scope: ".boxList" , pos: true , dragChange: true , animation_options:{ duration:200, //每次动画的事件 easing: "ease-in" //动画特效 ease-out、ease-in、linear } }); |
1
2
3
4
5
6 |
< input type = "button" class = "disable" value = "插件按钮" > < input type = "button" class = "disable_open" value = "函数开启拖拽" > < input type = "button" class = "disable_cloose" value = "函数禁止拖拽" > < div class = "boxList" > < div class = "one div13" ></ div > </ div > |
1
2
3
4
5
6
7
8
9
10
11
12
13 |
$( ".div13" ).Tdrag({ scope: ".boxList" , disable: true , disableInput: ".disable" }); //禁止 $( ".disable_cloose" ).on( "click" , function (){ $.disable_cloose() }); //开启 $( ".disable_open" ).on( "click" , function (){ $.disable_open() }); |