From 7c8824653de4e112d361bc01dc85d6a1fc24f15c Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 7 Jan 2008 23:55:49 +0000 Subject: [PATCH] Fix for widget sort with IE7. Props filosofo. see #5292 #5583 git-svn-id: http://svn.automattic.com/wordpress/trunk@6571 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/widgets.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/wp-admin/js/widgets.js b/wp-admin/js/widgets.js index b6301efcb2..882e40b388 100644 --- a/wp-admin/js/widgets.js +++ b/wp-admin/js/widgets.js @@ -102,11 +102,20 @@ jQuery(function($) { $('a.widget-control-add').click( addClick ); + var widgetSortable; + var widgetSortableInit = function() { + try { // a hack to make sortables work in jQuery 1.2+ and IE7 + $('#current-sidebar .widget-control-list').SortableDestroy(); + } catch(e) {} + widgetSortable = $('#current-sidebar .widget-control-list').Sortable( { + accept: 'widget-sortable', + helperclass: 'sorthelper', + handle: 'h4.widget-title', + onStop: widgetSortableInit + } ); + } + // initialize sortable - var widgetSortable = $('#current-sidebar .widget-control-list').Sortable( { - accept: 'widget-sortable', - helperclass: 'sorthelper', - handle: 'h4.widget-title' - } ); + widgetSortableInit(); });