⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dragdrop-debug.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 5 页
字号:
                while (p) {                    if (this.isHandle(id, p.id)) {                        return true;                    } else {                        YAHOO.log(p.id + " is not a handle", "info", "DragDropMgr");                        p = p.parentNode;                    }                }            }            return false;        }    };}();// shorter alias, save a few bytesYAHOO.util.DDM = YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}(function() {var Event=YAHOO.util.Event; var Dom=YAHOO.util.Dom;/** * Defines the interface and base operation of items that that can be  * dragged or can be drop targets.  It was designed to be extended, overriding * the event handlers for startDrag, onDrag, onDragOver, onDragOut. * Up to three html elements can be associated with a DragDrop instance: * <ul> * <li>linked element: the element that is passed into the constructor. * This is the element which defines the boundaries for interaction with  * other DragDrop objects.</li> * <li>handle element(s): The drag operation only occurs if the element that  * was clicked matches a handle element.  By default this is the linked  * element, but there are times that you will want only a portion of the  * linked element to initiate the drag operation, and the setHandleElId()  * method provides a way to define this.</li> * <li>drag element: this represents an the element that would be moved along * with the cursor during a drag operation.  By default, this is the linked * element itself as in {@link YAHOO.util.DD}.  setDragElId() lets you define * a separate element that would be moved, as in {@link YAHOO.util.DDProxy} * </li> * </ul> * This class should not be instantiated until the onload event to ensure that * the associated elements are available. * The following would define a DragDrop obj that would interact with any  * other DragDrop obj in the "group1" group: * <pre> *  dd = new YAHOO.util.DragDrop("div1", "group1"); * </pre> * Since none of the event handlers have been implemented, nothing would  * actually happen if you were to run the code above.  Normally you would  * override this class or one of the default implementations, but you can  * also override the methods you want on an instance of the class... * <pre> *  dd.onDragDrop = function(e, id) { *  &nbsp;&nbsp;alert("dd was dropped on " + id); *  } * </pre> * @namespace YAHOO.util * @class DragDrop * @constructor * @param {String} id of the element that is linked to this instance * @param {String} sGroup the group of related DragDrop objects * @param {object} config an object containing configurable attributes *                Valid properties for DragDrop:  *                    padding, isTarget, maintainOffset, primaryButtonOnly, */YAHOO.util.DragDrop = function(id, sGroup, config) {    if (id) {        this.init(id, sGroup, config);     }};YAHOO.util.DragDrop.prototype = {    /**     * An Object Literal containing the events that we will be using: mouseDown, b4MouseDown, mouseUp, b4StartDrag, startDrag, b4EndDrag, endDrag, mouseUp, drag, b4Drag, invalidDrop, b4DragOut, dragOut, dragEnter, b4DragOver, dragOver, b4DragDrop, dragDrop     * By setting any of these to false, then event will not be fired.     * @property events     * @type object     */    events: null,    /**    * @method on    * @description Shortcut for EventProvider.subscribe, see <a href="YAHOO.util.EventProvider.html#subscribe">YAHOO.util.EventProvider.subscribe</a>    */    on: function() {        this.subscribe.apply(this, arguments);    },    /**     * The id of the element associated with this object.  This is what we      * refer to as the "linked element" because the size and position of      * this element is used to determine when the drag and drop objects have      * interacted.     * @property id     * @type String     */    id: null,    /**     * Configuration attributes passed into the constructor     * @property config     * @type object     */    config: null,    /**     * The id of the element that will be dragged.  By default this is same      * as the linked element , but could be changed to another element. Ex:      * YAHOO.util.DDProxy     * @property dragElId     * @type String     * @private     */    dragElId: null,     /**     * the id of the element that initiates the drag operation.  By default      * this is the linked element, but could be changed to be a child of this     * element.  This lets us do things like only starting the drag when the      * header element within the linked html element is clicked.     * @property handleElId     * @type String     * @private     */    handleElId: null,     /**     * An associative array of HTML tags that will be ignored if clicked.     * @property invalidHandleTypes     * @type {string: string}     */    invalidHandleTypes: null,     /**     * An associative array of ids for elements that will be ignored if clicked     * @property invalidHandleIds     * @type {string: string}     */    invalidHandleIds: null,     /**     * An indexted array of css class names for elements that will be ignored     * if clicked.     * @property invalidHandleClasses     * @type string[]     */    invalidHandleClasses: null,     /**     * The linked element's absolute X position at the time the drag was      * started     * @property startPageX     * @type int     * @private     */    startPageX: 0,    /**     * The linked element's absolute X position at the time the drag was      * started     * @property startPageY     * @type int     * @private     */    startPageY: 0,    /**     * The group defines a logical collection of DragDrop objects that are      * related.  Instances only get events when interacting with other      * DragDrop object in the same group.  This lets us define multiple      * groups using a single DragDrop subclass if we want.     * @property groups     * @type {string: string}     */    groups: null,    /**     * Individual drag/drop instances can be locked.  This will prevent      * onmousedown start drag.     * @property locked     * @type boolean     * @private     */    locked: false,    /**     * Lock this instance     * @method lock     */    lock: function() { this.locked = true; },    /**     * Unlock this instace     * @method unlock     */    unlock: function() { this.locked = false; },    /**     * By default, all instances can be a drop target.  This can be disabled by     * setting isTarget to false.     * @property isTarget     * @type boolean     */    isTarget: true,    /**     * The padding configured for this drag and drop object for calculating     * the drop zone intersection with this object.     * @property padding     * @type int[]     */    padding: null,    /**     * If this flag is true, do not fire drop events. The element is a drag only element (for movement not dropping)     * @property dragOnly     * @type Boolean     */    dragOnly: false,    /**     * If this flag is true, a shim will be placed over the screen/viewable area to track mouse events. Should help with dragging elements over iframes and other controls.     * @property useShim     * @type Boolean     */    useShim: false,    /**     * Cached reference to the linked element     * @property _domRef     * @private     */    _domRef: null,    /**     * Internal typeof flag     * @property __ygDragDrop     * @private     */    __ygDragDrop: true,    /**     * Set to true when horizontal contraints are applied     * @property constrainX     * @type boolean     * @private     */    constrainX: false,    /**     * Set to true when vertical contraints are applied     * @property constrainY     * @type boolean     * @private     */    constrainY: false,    /**     * The left constraint     * @property minX     * @type int     * @private     */    minX: 0,    /**     * The right constraint     * @property maxX     * @type int     * @private     */    maxX: 0,    /**     * The up constraint      * @property minY     * @type int     * @type int     * @private     */    minY: 0,    /**     * The down constraint      * @property maxY     * @type int     * @private     */    maxY: 0,    /**     * The difference between the click position and the source element's location     * @property deltaX     * @type int     * @private     */    deltaX: 0,    /**     * The difference between the click position and the source element's location     * @property deltaY     * @type int     * @private     */    deltaY: 0,    /**     * Maintain offsets when we resetconstraints.  Set to true when you want     * the position of the element relative to its parent to stay the same     * when the page changes     *     * @property maintainOffset     * @type boolean     */    maintainOffset: false,    /**     * Array of pixel locations the element will snap to if we specified a      * horizontal graduation/interval.  This array is generated automatically     * when you define a tick interval.     * @property xTicks     * @type int[]     */    xTicks: null,    /**     * Array of pixel locations the element will snap to if we specified a      * vertical graduation/interval.  This array is generated automatically      * when you define a tick interval.     * @property yTicks     * @type int[]     */    yTicks: null,    /**     * By default the drag and drop instance will only respond to the primary     * button click (left button for a right-handed mouse).  Set to true to     * allow drag and drop to start with any mouse click that is propogated     * by the browser     * @property primaryButtonOnly     * @type boolean     */    primaryButtonOnly: true,    /**     * The availabe property is false until the linked dom element is accessible.     * @property available     * @type boolean     */    available: false,    /**     * By default, drags can only be initiated if the mousedown occurs in the     * region the linked element is.  This is done in part to work around a     * bug in some browsers that mis-report the mousedown if the previous     * mouseup happened outside of the window.  This property is set to true     * if outer handles are defined.     *     * @property hasOuterHandles     * @type boolean     * @default false     */    hasOuterHandles: false,    /**     * Property that is assigned to a drag and drop object when testing to     * see if it is being targeted by another dd object.  This property     * can be used in intersect mode to help determine the focus of     * the mouse interaction.  DDM.getBestMatch uses this property first to     * determine the closest match in INTERSECT mode when multiple targets     * are part of the same interaction.     * @property cursorIsOver     * @type boolean     */    cursorIsOver: false,    /**     * Property that is assigned to a drag and drop object when testing to     * see if it is being targeted by another dd object.  This is a region     * that represents the area the draggable element overlaps this target.     * DDM

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -