admin管理员组文章数量:1356865
Now i'm using jQuery library and i faced the folowing problem: Supppose i have the sortable list if items
<html>
<head>
<script src=".js"></script>
<script src=".4/jquery.min.js> </script>
<script src=".8/jquery-ui.min.js"></script>
<script>
$(document).ready(function(){
jQuery(".block").sortable({
axis: 'y'
});
});
</script>
</head>
<body>
<ul class="block" type="none">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</body>
</html>
So ofter order changed, how can i make listener for this event, i mean ,is there any listener for order changed event or something like this.
Now i'm using jQuery library and i faced the folowing problem: Supppose i have the sortable list if items
<html>
<head>
<script src="http://code.jquery./jquery-latest.js"></script>
<script src="http://ajax.googleapis./ajax/libs/jquery/1.4/jquery.min.js> </script>
<script src="http://ajax.googleapis./ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function(){
jQuery(".block").sortable({
axis: 'y'
});
});
</script>
</head>
<body>
<ul class="block" type="none">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</body>
</html>
So ofter order changed, how can i make listener for this event, i mean ,is there any listener for order changed event or something like this.
Share Improve this question asked Aug 1, 2012 at 7:18 ilya.stmnilya.stmn 1,6245 gold badges23 silver badges41 bronze badges 1- 1 Ya! there is check the documentation of jquery ui sortable. – SVS Commented Aug 1, 2012 at 7:20
2 Answers
Reset to default 7It's right there in the documentation. Use the change
or update
event:
$(document).ready(function(){
$(".block").sortable({
axis: 'y',
change: function(event, ui) {
console.log('change', event, ui);
},
update: function(event, ui) {
console.log('update', event, ui);
}
});
});
Also either use jQuery
or $
, don't mix them.
Yes,
$( ".selector" ).bind( "sort", function(event, ui) {
...
});
Directly from the documentation.
本文标签: javascriptorder changed event in jquery sortableStack Overflow
版权声明:本文标题:javascript - order changed event in jquery sortable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743986906a2571433.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论