-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.rowSlide.js
30 lines (30 loc) · 1.13 KB
/
jquery.rowSlide.js
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
28
29
30
/*** Leith's rowSlide functions ***/
$.fn.rowSlideUp = function(duration, callback) {
if (!duration) duration = 500;
if (!callback) callback = function() {};
return $(this)
.find('td,th').wrapInner('<div/>').end()
.find('td > div, th > div').slideUp(duration, function() {
$(this).closest('tr').hide(0, function() {
$(this).find('td > div, th > div').each(function() {
var $children = $(this).children();
if ($children.length > 0) { $children.unwrap(); }
else { $(this).replaceWith($(this).html()); }
});
if (callback && typeof(callback) === "function") callback.call(this);
});
});
};
$.fn.rowSlideDown = function(duration, callback) {
if (!duration) duration = 500;
if (!callback) callback = function() {};
return $(this)
.find('td,th').wrapInner('<div style="display:none;"/>').end()
.show(0)
.find('td > div, th > div').slideDown(duration, function() {
var $children = $(this).children();
if ($children.length > 0) { $children.unwrap(); }
else { $(this).replaceWith($(this).html()); }
if (callback && typeof(callback) === "function") callback.call(this);
});
};