开发者

Change CSS with jQuery Sortable

How can I change开发者_如何学Python CSS property once sorted. Something likes this:

    $( "#sort" ).sortable({

        $(#div1).css("background-color","yellow");
    }); 

Thanks alot


When you call initiate the plugin, make sure you pass a handler for the stop event:

$('#sort').sortable({
    stop: function(){
        $('#div1').css('background-color','yellow');
    }
});


http://docs.jquery.com/UI/Sortable#events

$( ".selector" ).sortable({
    update: function(event, ui) { ... }
});


Look at the events for sortable on the jQuery UI website: http://jqueryui.com/demos/sortable/#events

Depending on the event you want, you can use:

$( "#sort" ).sortable({
    change: function(){
        $("#div1").css("background-color","yellow");
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜