开发者

Only able to drag draggable element once

I'm working on a small app where I drag element to a droppable area. I recently upgraded to jQuery 1.5 and I discovered that I can only drag an element once.

That means that if the user accidently drops it somewhere else other than the droppable element, he will not be able to drag it again.

I am using jQuery 1.5 and jQuery UI 1.8.9.

I set the draggable state to each element via a .each function.

Has anybody else had this problem? I'm a jQuery novice, and I am thankful for any help :)

    $(itemId).draggable({ 
    zIndex: 2700,
    helper: "clone",
    scroll: false,
    drag: function(event, ui) 
    {
        $("#container").css("background-color", "#fff");
    },
    stop: function(event, ui) 
    {
        $("#conatiner").css("background-color", "#F0EBE0");

    }
});

[EDIT] I should also add that I have delegated a click event to the same object with the delegate function. Although it wasn't a problem be开发者_StackOverflow中文版fore.


This is a bug introduced with jQuery 1.5, and it will be fixed in jQuery 1.5.1: http://bugs.jqueryui.com/ticket/6922

You'll need to revert back to jQuery 1.4.4 until 1.5.1 is released.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜