Dragging a div using Javascript

Discussion in 'JavaScript' started by mkb24, Mar 15, 2011.

  1. #1
    Hi,

    I have tried to search on the internet and failed.

    I am facing some problem and need help urgently.

    I have created a div which is visible on click on a link.

    In the Pop Up <div> which appears, I want to create an anchor which is - Move.

    The functionality of the Move - is to be able to drag the parent div any where on the Browser page and it should work in all Browsers.

    Please can some one help me with the code-spec ?????

    Below is the code spec which calls the invisible div...

    
    <html>
    <head>
    <title>Pop Ups</title>
    
    <script language="javascript" type="text/javascript">
    
    //Code added for pop ups
    function expand(id)
    {
    	//alert("expand"+ id);
    	document.getElementById(id).style.visibility="visible";
    }
    function collapse(id)
    {
    	//alert("collapse"+ id);
    	document.getElementById(id).style.visibility="hidden";
    }
    </script>
    
    </head>
    
    <body>
    
    <p class="paraWithLinkedImg"><a href="javascript:expand('divPopUp1')">Links</p>		
    
    <div class="divPopUp" id="divPopUp1" style="visibility:hidden; border:1px solid #000000;"> 
    	<div class="divPopUpContentArea">
    		<div class="divContentArea">
    			<div class="divPopUpButton">
    				<ul>
    					<li><a href="javascript:collapse('divPopUp1')" title="Close" ><span>CLOSE</span></a></li>
    					<li><span>MOVE</span></li>
    				</ul>
    			</div>
    				<p>Contents of the div</p>
    		</div><!-- divContentArea ENDS -->
    	</div><!-- divPopUpContentArea ENDS -->
    	<div class="divClr" style="clear:both"></div>
    </div><!-- divPopUp1 ENDS -->
    
    
    </body>
    </html>
    
    
    HTML:

    Thanks alot - in advance...
     
    mkb24, Mar 15, 2011 IP
  2. artus.systems

    artus.systems Well-Known Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    103
  3. lukefowell89

    lukefowell89 Peon

    Messages:
    182
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    lukefowell89, Mar 21, 2011 IP
  4. Mail Propeller

    Mail Propeller Peon

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Mail Propeller, Mar 30, 2011 IP
  5. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ext js is awsome im about to start a large development project using it and am very excited
     
    srisen2, Mar 31, 2011 IP