javascript - Change CSS with jQuery Sortable - Stack Overflow

How can I change CSS property once sorted. Something likes this:$( "#sort" ).sortable({$(#div

How can I change CSS property once sorted. Something likes this:

    $( "#sort" ).sortable({

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

Thanks alot

How can I change CSS property once sorted. Something likes this:

    $( "#sort" ).sortable({

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

Thanks alot

Share Improve this question asked Aug 5, 2011 at 14:52 jQuerybeastjQuerybeast 14.5k39 gold badges120 silver badges198 bronze badges 1
  • Can you be more specific? Are you trying to style them to show which one was sorted? – Joe Flynn Commented Aug 5, 2011 at 14:55
Add a ment  | 

3 Answers 3

Reset to default 6

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./UI/Sortable#events

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

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

Depending on the event you want, you can use:

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744989657a4604825.html

相关推荐

  • javascript - Change CSS with jQuery Sortable - Stack Overflow

    How can I change CSS property once sorted. Something likes this:$( "#sort" ).sortable({$(#div

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信