Drag and drop: hover class : Drag Drop « Scriptaculous « JavaScript DHTML






Drag and drop: hover class

 
<!--
Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<!-- revised from scriptaculous-js-1.8.2 demo code  -->
<html>
<head>
<title>script.aculo.us Drag and drop functional test file</title>
<script src="scriptaculous-js-1.8.2/lib/prototype.js" type="text/javascript"></script>
<script src="scriptaculous-js-1.8.2/src/scriptaculous.js" type="text/javascript"></script>
<script src="scriptaculous-js-1.8.2/src/unittest.js" type="text/javascript"></script>
</head>
<style>
  div.hoverclass123 {
    border:1px solid red;
  }
</style>
<body>

<h1>script.aculo.us Drag and drop functional test file</h1>

<h2>w/o hoverclass</h2>

<div id="cart" class="cart" style="text-align:center;height:50px;padding:10px;background-color:#fba">
### DROP HERE ###
</div>

<script type="text/javascript">Droppables.add('cart', {onDrop:function(element,dropon){alert('w/o hoverclass, should be \'product_id\':' + encodeURIComponent(element.id) + ', dropon should be \'cart\':' + dropon.id)}})</script>

<br/>

<img alt="Product2" id="product_id" src="icon.png" /> &lt;-- drag this!

<script type="text/javascript">new Draggable('product_id', {revert:true})</script>

<h2>w/ hoverclass</h2>


<div id="carth" class="cart" style="text-align:center;height:50px;padding:10px;background-color:#fba">
### DROP HERE ###
</div>

<script type="text/javascript">Droppables.add('carth', {hoverclass:'hoverclass123',onDrop:function(element, dropon, event){alert('w/ hoverclass: should be \'product_id\':' + encodeURIComponent(element.id) + ', dropon should be \'carth\':' + dropon.id)}})</script>


</body>
</html>

   
  








Related examples in the same category

1.Drag and drop: invert
2.Drag and drop to reorder
3.Drag and drop: ghosting effect
4.Drag and drop: snap
5.Drag and drop: force to scroll
6.Drag and drop between two tables
7.Droppable target
8.Add delay to drag and drop
9.Draggable handle
10.Ghosting vs. non-ghosting
11.Draggable with scroll bar