From c70de3ebd640c8643f0b61b8b1cd067142439414 Mon Sep 17 00:00:00 2001 From: vmire Date: Wed, 17 Feb 2016 11:30:49 +0100 Subject: [PATCH] add fadeOut duration parameter for remove_widget method Rremoving a widget is very slow because of the default jQuery fadeOut duration (400ms). Add the ability to specify a fadeout value will provide a more responsive user interface (30ms is a better value in my opinion) --- src/jquery.gridster.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 7bac9118..5c359a4b 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -719,9 +719,10 @@ * @param {Boolean|Function} silent If true, widgets below the removed one * will not move up. If a Function is passed it will be used as callback. * @param {Function} callback Function executed when the widget is removed. + * @param {Integer} element fadeout duration (milliseconds) (jQuery default: 400) * @return {Class} Returns the instance of the Gridster Class. */ - fn.remove_widget = function(el, silent, callback) { + fn.remove_widget = function(el, silent, callback, fadeoutDuration) { var $el = el instanceof $ ? el : $(el); var wgd = $el.coords().grid; @@ -738,7 +739,7 @@ this.remove_from_gridmap(wgd); - $el.fadeOut($.proxy(function() { + $el.fadeOut(fadeoutDuration,$.proxy(function() { $el.remove(); if (!silent) {