Last change
on this file since 25381 was 12011, checked in by shaoqun, 18 years ago |
javascript package for berry basket
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.1 KB
|
Rev | Line | |
---|
[12011] | 1 |
|
---|
| 2 | /* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * @class a DragDrop implementation that moves the object as it is being dragged,
|
---|
| 6 | * and keeps the object being dragged on top. This is a subclass of ygDD rather
|
---|
| 7 | * than DragDrop, and inherits the implementation of most of the event listeners
|
---|
| 8 | * from that class.
|
---|
| 9 | *
|
---|
| 10 | * @extends ygDD
|
---|
| 11 | * @constructor
|
---|
| 12 | * @param {String} id the id of the linked element
|
---|
| 13 | * @param {String} sGroup the group of related DragDrop items
|
---|
| 14 | */
|
---|
| 15 | function ygDDOnTop(id, sGroup) {
|
---|
| 16 | if (id) {
|
---|
| 17 | this.init(id, sGroup);
|
---|
| 18 |
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | ygDDOnTop.prototype = new YAHOO.util.DD();
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The inital z-index of the element, stored so we can restore it later
|
---|
| 26 | *
|
---|
| 27 | * @type int
|
---|
| 28 | */
|
---|
| 29 | ygDDOnTop.prototype.origZ = 0;
|
---|
| 30 |
|
---|
| 31 | ygDDOnTop.prototype.startDrag = function(x, y) {
|
---|
| 32 |
|
---|
| 33 | var style = this.getEl().style;
|
---|
| 34 |
|
---|
| 35 | // store the original z-index
|
---|
| 36 | this.origZ = style.zIndex;
|
---|
| 37 |
|
---|
| 38 | // The z-index needs to be set very high so the element will indeed be on top
|
---|
| 39 | style.zIndex = 999;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | ygDDOnTop.prototype.endDrag = function(e) {
|
---|
| 43 |
|
---|
| 44 | // restore the original z-index
|
---|
| 45 | this.getEl().style.zIndex = this.origZ;
|
---|
| 46 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.