Dragged object is on top : Drag Drop : GUI Components JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » GUI Components » Drag Drop »

 

Dragged object is on top




<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Yahoo! UI Library - Drag and Drop</title>
<link rel="stylesheet" type="text/css" href="./examples/dragdrop/css/screen.css">
</head>
  
<body>

<script type="text/javascript" src="./build/yahoo/yahoo.js" ></script>
<script type="text/javascript" src="./build/event/event.js" ></script>
<script type="text/javascript" src="./build/dom/dom.js"></script>
<script type="text/javascript" src="./build/logger/logger.js"></script>

<script type="text/javascript" src="./build/dragdrop/dragdrop-debug.js" ></script>
        <script type="text/javascript" src="./examples/dragdrop/js/DDOnTop.js" ></script>

<script type="text/javascript" language="JavaScript">

YAHOO.example.DDApp = function() {
    var dd, dd2, dd3;

    return {
        init: function() {
            dd = new YAHOO.example.DDOnTop("dragDiv1");
            dd.addInvalidHandleId("excludeid3");
            dd.addInvalidHandleClass("excludeclass2");

            dd2 = new YAHOO.example.DDOnTop("dragDiv2");
            // dd2.setPadding(-10);
            // dd2.setXConstraint(100, 100);
            // dd2.setYConstraint(0, 0);

            dd3 = new YAHOO.example.DDOnTop("dragDiv3");
        }
    };
} ();

YAHOO.util.Event.addListener(window, "load", YAHOO.example.DDApp.init);
    
</script>
<style type="text/css">

#dragDiv1 {
    background:url(./examples/dragdrop/img/sq1.png0 0 no-repeat;
    background-color:#6D739A;top:240px; left:105px;
}
#excludeid1 {
    position:absolute; top:20px; left:20px;height:20px;width:20px;
    background-color:#333333;
}
#excludeid2 {
    position:absolute; top:40px; left:40px;height:20px;width:20px;
    background-color:#333333;
}
#excludeid3 {
    position:absolute; top:60px; left:60px;height:20px;width:20px;
    background-color:#333333;
}
#maskDiv {
    position: absolute; top:0px; left: 0px; width:100px; height:20px;
}

#dragDiv2 {
    background:url(./examples/dragdrop/img/sq2.png0 0 no-repeat;background-color:#566F4E;
    top:350px; left:215px;
}

#dragDiv3 {
    background:url(./examples/dragdrop/img/sq3.png0 0 no-repeat;background-color:#7E5B60;
    top:460px; left:325px;
}

</style>
<div id="pageTitle"><h3>Drag and Drop - DD</h3></div>

  
<style type="text/css">

/* logger default styles */
/* font size is controlled here: default 77% */
#yui-log {position:absolute;top:1em;right:1em;font-size:77%;text-align:left;}
/* width is controlled here: default 31em */
.yui-log {background-color:#AAA;border:1px solid black;font-family:monospace;z-index:9000;}
.yui-log p {margin:1px;padding:.1em;}
.yui-log button {font-family:monospace;}
.yui-log .yui-log-hd {padding:.5em;background-color:#575757;color:#FFF;}
/* height is controlled here: default 20em*/
.yui-log .yui-log-bd {width:100%;height:20em;background-color:#FFF;border:1px solid gray;overflow:auto;}
.yui-log .yui-log-ft {margin-top:.5em;margin-bottom:1em;}
.yui-log .yui-log-ft .yui-log-categoryfilters {}
.yui-log .yui-log-ft .yui-log-sourcefilters {width:100%;border-top:1px solid #575757;margin-top:.75em;padding-top:.75em;}
.yui-log .yui-log-btns {position:relative;float:right;bottom:.25em;}
.yui-log .yui-log-filtergrp {margin-right:.5em;}
.yui-log .info {background-color:#A7CC25;/* A7CC25 green */
.yui-log .warn {background-color:#F58516;/* F58516 orange */
.yui-log .error {background-color:#E32F0B;/* E32F0B red */
.yui-log .time {background-color:#A6C9D7;/* A6C9D7 blue */
.yui-log .window {background-color:#F2E886;/* F2E886 tan */


</style>


<img id="ylogo" src="./examples/dragdrop/img/logo.gif" />

<div id="container">
<div id="containerTop">
<div id="header">
<h4>&nbsp;</h4>
</div>
<div id="main">

<div id="rightbar">

<div id="rightBarPad">
<h3>Examples</h3>
<script type="text/javascript">
    YAHOO.example.logApp = function() {
        return {
            init: function() {
                if (YAHOO.widget.Logger) {
                    var reader = new YAHOO.widget.LogReader"logDiv"
                            newestOnTop: true, height: "400px" } );

                    reader._onClickPauseBtn(null, reader);

                }
            }
        };
    } ()

    YAHOO.util.Event.on(window, "load", YAHOO.example.logApp.init);

</script>

</h4>
<div id="logDiv"></div>
</div>


</div>

  <div id="content">
    <form name="dragDropForm" action="javscript:;">
    <div class="newsItem">
      <h3>Dragged object is on top</h3>
      <p>
        This example is identical to the basic drag and drop implementation, 
        YAHOO.util.DD,
        but we have extended it so that the square that is being dragged is positioned
        on top of the others.
      </p>
<strong>The logger is paused for performance reasons.  Click "Resume" to re-enable it.</strong>
      <div id="workArea">&nbsp;</div>
      <p>&nbsp;</p>
    </div>
    </form>
  </div>
    
        <div id="footerContainer">
        <div id="footer">
          <p>&nbsp;</p>
        </div>
      </div>
    </div>
  </div>
</div>


    <div id="dragDiv1" class="testSquare">
        DDOnTop
        <div id="excludeid1" class="excludeclass1">&nbsp;</div>
        <div id="excludeid2" class="excludeclass2">&nbsp;</div>
        <div id="excludeid3" class="excludeclass1">&nbsp;</div>
        <div id="maskDiv">&nbsp;</div>
    </div>
    <div id="dragDiv2" class="testSquare">
        <a href="#">DDOnTop</a>
    </div>
    <div id="dragDiv3" class="testSquare">DDOnTop</div>
 
  </body>
</html>

           
       

Download : Download nav_yui.zip nav_yui.zip


-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo GUI Components
» Drag Drop