我试图弄清楚如何使被丢弃的元素再次拖拽以便有可能将其拖回来。我有2个div与类.cell,我希望能够从.cell拖放到另一个
$('.users main .col.details form .row.stations .table .cell ul li').draggable({
zIndex: 100,
revert: true,
opacity: 0.35,
appendTo: "body",
refreshPositions: true
});
$('.users main .col.details form .row.stations .table .cell').droppable({
hoverClass: "drop-hover",
drop: function( event, ui ) {
var classes = ui.draggable.attr('class');
$("<li></li>").text( ui.draggable.text()).addClass(classes).appendTo($(this).find('ul'));
ui.draggable.remove();
}
});
任何解决方案?
答案 0 :(得分:0)
在draggable
部分删除droppable
对象时,您无需重新创建append
对象。如果您只是li
可拖动的$('.users main .col.details form .row.stations .table .cell').droppable({
hoverClass: "drop-hover",
drop: function(event, ui) {
$(this).find('ul').append(ui.draggable);
}
});
,它将保持其可拖动性&#34;:
module Main where
import HAppS.Server.AlternativeHTTP
import HAppS.Server.HTTP.AltFileServe
import Control.Monad.State
import Numeric
import Contracts
instance FromData ExContr where
fromData = do c <- look "contract"
arg1 <- look "arg1"
arg2 <- look "arg2"
img <- look "image"
return $ ExContr (c, map fst $ readFloat arg1
++ readFloat arg2, read img)
main :: IO ()
main = do simpleHTTP [dir "contractEx"
[withData $ \(ExContr t) ->
[anyRequest $ liftIO $ liftM toResponse =<< renderEx (ExContr t)]
,anyRequest $ ok $ toResponse renderExDefault]
,fileServe ["Contracts.html"] "public" -- fileserving
]
<强> Fiddle Demo 强>