javascript - Drag, Drop, Sort, Clone and Change Class Not Working -
here's i'm trying accomplish
(version 2.0 new code updates)
i'm trying create module has 2 columns. left , right. want buttons in left column when dropped right change classes. when buttons on left dropped on right want them call animated class per-defined transitions in larger image. these boxes drag , droppable in right column.
again need module drag, drop, clone, sort , change classes. have figured out except changing of classes. i've been working on time insight appreciated. thanks.
here's picture , code
here's picture of i'm trying accomplish - twitter pic.
here's my new fiddle project.
suggested code isn't working
here's latest effort alter javascript advised on post. script still isn't working. understand i'm trying do, missing. little anyone?
$('ui-sortable-handle').droppable({ drop: function(event, ui) { if($(this).attr('id').indexof('music')){ $(this).addclass("droppedlimusic"); } else if($(this).attr('id').indexof('nav')){ $(this).addclass("droppedlinav"); } }, over: function(event, ui) {}, out: function(event, ui) {} });
the following code version 3 of work still isn't working...sigh..
$("#left-pane li").draggable({ containment: '#gbox', cursor: 'move', helper: 'clone', scroll: false, connecttosortable: '#right-pane', appendto: '#right-pane', start: function () {}, stop: function (event, ui) {} }).mousedown(function () {}); $("#right-pane").sortable({ sort: function () {}, placeholder: 'ui-state-highlight', receive: function () {}, update: function (event, ui) {} }); $("#right-pane li").live('dblclick', function () { $(this).remove(); }) $("#right-pane").droppable({ accept: "#left-pane li", accept: ":not(.ui-sortable-helper)", drop: function (event, ui) { if ($(ui.draggable).find('.single-item').length == 0) { $(ui.draggable).append("<div class='single-item'><input type='text' class='item-title' /><br /><textarea class='item-text'></textarea></div>"); } } }); $("#left-pane").droppable({ accept: "#right-pane li", drop: function (event, ui) {} }); $("ul, li").disableselection();
original module html
<div class="wrapper"> <div class="left-column"> <ul id="left-pane"> <li class="music"><a href=""><img src="http://www.natebal.com/images/seo.jpg" width="55px" /></a></li> <li class="nav"><a href=""><img src="http://www.natebal.com/images/social-networks.jpg" width="55px" /></a></li> <li class="phone"><a href=""><img src="http://www.natebal.com/images/sweet-web-development.jpg" width="55px" /></a></li> </ul> </div> <div class="right-column"> <ul id="right-pane"></ul> </div> </div>
i think searching for..
if($('#music').hasclass('droppedlimusic')){ //your code }
Comments
Post a Comment