-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpullout_panel.js
56 lines (44 loc) · 1.46 KB
/
pullout_panel.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$.fn.pulloutPanel = function(options) {
var settings = $.extend({}, $.fn.pulloutPanel.defaults, options);
once(function() {
Csster.style({
'.pullout_panel': {
position: 'fixed',
bottom: 0,
has: [settings.css]
}
});
});
return $(this).each(function() {
var $this = $(this);
if ($this.hasClass('pullout_panel')) return;
$this.addClass('pullout_panel');
$this.bind('open', function() {
$this.animate({bottom: 0}, 'slow', 'easeOutBounce', function() {
$this.removeClass('closed').addClass('opened');
$this.trigger('opened');
});
});
$this.bind('close', function() {
var height = $this.innerHeight();
$this.animate({bottom: -height + 50}, 'slow', 'easeOutBounce', function() {
$this.addClass('closed').removeClass('opened');
$this.trigger('closed');
});
});
$this.bind('toggle', function() {
$this.trigger($this.hasClass('opened') ? 'close' : 'open');
});
$this.trigger(settings.open ? 'open' : 'close');
});
};
$.fn.pulloutPanel.defaults = {
attachTo: 'bottom',
css: {
left: 0,
minHeight: 390,
border: '1px 1px 1px 0 solid #666',
has: [roundedCorners('tr', 10),boxShadow([0,0], 10, 'red')],
cursor: 'pointer'
}
};