File: dragdrop2_test.html

package info (click to toggle)
scriptaculous 1.9.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 952 kB
  • sloc: javascript: 8,533; makefile: 2
file content (85 lines) | stat: -rw-r--r-- 3,203 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>script.aculo.us Drag and drop functional test file</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <script src="../../lib/prototype.js" type="text/javascript"></script>
  <script src="../../src/scriptaculous.js" type="text/javascript"></script>
  <script src="../../src/unittest.js" type="text/javascript"></script>
  <style type="text/css" media="screen">
    #thelist li { background: green; margin:5px; padding: 30px; }
    #thelist2 li { background: #ffb; margin:2px; padding: 2px; }
  </style>
</head>
<body>
<h1>script.aculo.us Drag and drop functional test file</h1>

<h2>Draggables/Droppables</h2>

<div id="revertbox1" class="box1" style="z-index:1000;width:150px;height:150px;background:#bbf;">
  <span id="handle1">drag here</span><br/>
  <input type="checkbox" id="shouldrevert1"/> Revert?
</div>

<div id="revertbox2" class="box" style="z-index:1000;width:150px;height:150px;background:#bbf;">
  <span id="handle2">drag here</span><br/>
  <input type="checkbox" id="shouldrevert2"/> Revert?
  I've onStart, onDrag and onEnd events!<br/>
  <span id="event-info"></span>
</div>

<div id="specialbox" class="box" style="z-index:1000;width:150px;height:150px;background:#fbb;">
  This box overrides the default endeffect
</div>

<div id="specialbox2" class="box" style="z-index:1000;width:150px;height:150px;background:#fbb;">
  This box overrides the default starteffect
</div>

<div id="specialbox3" class="box" style="z-index:1000;width:150px;height:150px;background:#fbb;">
  This box overrides the default end- and starteffects
</div>

<div id="droptarget1" style="width:200px;height:200px;background-color:#eee;">accepts first box</div>
<div id="droptarget2" style="width:200px;height:200px;background-color:#eee;">accepts second box</div>

<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
  new Draggable('revertbox1',{scroll:window,handle:'handle1',revert:function(element){return ($('shouldrevert1').checked)}});
  new Draggable('revertbox2',{
    handle:'handle2',
    revert:function(element){return ($('shouldrevert2').checked)},
    onStart:function(){$('revertbox2').setStyle({backgroundColor:'#bfb'})},
    onDrag:function(){$('event-info').update('drag!')},
    onEnd:function(){alert('end!')}
  });
  
  Droppables.add('droptarget1',{accept:['box1','otherstuff'],onDrop:function(){alert('drop!')}});
  Droppables.add('droptarget2',{accept:'box',onDrop:function(){alert('drop!')}});
  
  
  new Draggable('specialbox',{
    endeffect:function(){
      new Effect.Highlight('specialbox',{queue:'end'});
    }
  });
  new Draggable('specialbox2',{
    starteffect:function(){
      new Effect.Highlight('specialbox2',{queue:'end'});
    }
  });
  new Draggable('specialbox3',{
    starteffect:function(){
      new Effect.Highlight('specialbox3',{queue:'end'});
    },
    endeffect:function(){
      new Effect.Highlight('specialbox3',{queue:'end'});
    }
  });
// ]]>
</script>


</body>
</html>