2

i want to make a sidebar with some menu and the menu should can drag and drop !

here is the code :

                <div class="sidebar"  ondrop="drop(event)" ondragover="allowDrop(event)">
                <div class="about" draggable="true"  ondragstart="drag(event)" id="about">
                    <div class="top"><p>about us</p></div>
                    <p class="about"></p>
                </div>
                <div class="contact" draggable="true"  ondragstart="drag(event)" id="contact">
                    <div class="top"><p>contact us</p></div>
                    <form class="contact" action="script/mail.php" method="post" target="ifrm">
                     //Some INPUT
                    </form>
                    <div class="clear"></div>
                </div>
            </div>

the drag and drop is working well now but it's also pussible to drag "about us" and contact us" into eachother or into the form input and i want to disable this !!! how i sould do this ?

j0k
  • 22,600
  • 28
  • 79
  • 90
SaeedSaedi
  • 41
  • 5

1 Answers1

0

Learn about event bubbling, then check event.target in your drop() and allowDrop() functions.

Community
  • 1
  • 1
robertc
  • 74,533
  • 18
  • 193
  • 177