JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 18th, 2007, 08:40 AM
30equals 30equals is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 3 30equals User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 7 sec
Reputation Power: 0
Other - Ajax drag list question

hey everyone

i just made a sortable list with div's using ajax (scriptaculous) & php.

all works fine. but now i have a question.

is it possible to use an image in the div as some sort of anchor element , so you cannot drag & drop the div itself, but use the img to move the div ?

i've tried some stuff but it doesn't work..

here's my code

Code:
<?php
    require_once('database.php');
    require_once('menu.php');
 
    if (!dbConnect()) {
        echo 'Error connecting to database';
        exit;
    }
 
    $navs = getMenu();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title></title>
     
 
        <script type="text/javascript" src="js/prototype.js"></script>
        <script type="text/javascript" src="js/scriptaculous.js"></script>
		<style type="text/css">
		.sortable-list {
			list-style-type : none;
			margin : 0;
			padding:0px;
		}
		.sortable-list div {
			border : 1px solid #000;
			margin : 2px 0 2px 0;
			padding : 3px;
			background : #f7f7f7;
			border : #ccc;
			width : 400px;
		}
		.sortable-list img{
			cursor:move;
		}
		
		</style>
    </head>
    <body>
        <h1>testeuuuh</h1>
 
        <div id="menuList" class="sortable-list">
            <?php foreach ($navs as $nav_id => $name) { ?>
               <div id="nav_<?= $nav_id ?>"> <img src="images/drag.gif"/><?= $name ?></div>
            <?php } ?>
        </div>
 <div id="workingMsg" style="display:none;">Updating database...</div>
        <script type="text/javascript">
            function updateOrder(container)
            {
                var options = {
                                method : 'post',
                                parameters : Sortable.serialize("menuList")
                              };
 
                new Ajax.Request('processor.php', options);
				
				
				
            }
 
            Sortable.create('menuList', {tag:'div', onUpdate : updateOrder });
        </script>
    </body>
</html>


thanx!

Reply With Quote
  #2  
Old July 18th, 2007, 08:50 AM
30equals 30equals is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 3 30equals User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 7 sec
Reputation Power: 0
jeez...nevermind already.

i just needed to add a handle option in de sortable.create




Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Other - Ajax drag list question


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap