public
Last active

Workaround to Sorting problem in JQuery 1.3.1

  • Download Gist
application.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// Sorting in JQv1.3.1 does not call remove or revert
// The workaround is to include JQv1.2.6 AFTER JQv1.3.1
// and call jQuery.noConflict(); to push JQv1.2.6 into
// the jQuery and restore $ to JQv1.3.1. Subsecuently
// one can use jQuery("...").sortable("...")... to apply
// the sortable functionality to an element using JQv1.2.6.
$(document).ready(function(){
jQuery.noConflict();
// Using sortable from JQv1.2.6
jQuery("ul").sortable({
connectWith: ['ul'],
placeholder: 'placeholder',
opacity:'0.5',
remove:function( event, ui ){
// If you are using Firebug, you should see this message print out in the console on remove.
console.debug( "Removing event:%o ui:%o", event, ui )
},
receive:function( event, ui ){
// If you are using Firebug, you should see this message print out in the console on receive.
console.debug( "Receiving event:%o ui:%o", event, ui )
}
});
// .live is supported in JQv1.3.1
$("p").live("click", function(){
console.info("Called!");
});
});
index.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script src="javascripts/jquery-1.3.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/jquery-1.2.6.min.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/jquery-ui-personalized-1.5.3.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<ul>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>
<ul>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>
</body>
</html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.