My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 66 attachment: mousewheelscroll.patch (3.0 KB)

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Index: jquery/jquery.mousewheel.js
===================================================================
--- jquery/jquery.mousewheel.js (revision 0)
+++ jquery/jquery.mousewheel.js (revision 0)
@@ -0,0 +1,60 @@
+/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
+ * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
+ *
+ * Version: 3.0.2
+ *
+ * Requires: 1.2.2+
+ */
+
+(function($) {
+
+var types = ['DOMMouseScroll', 'mousewheel'];
+
+$.event.special.mousewheel = {
+ setup: function() {
+ if ( this.addEventListener )
+ for ( var i=types.length; i; )
+ this.addEventListener( types[--i], handler, false );
+ else
+ this.onmousewheel = handler;
+ },
+
+ teardown: function() {
+ if ( this.removeEventListener )
+ for ( var i=types.length; i; )
+ this.removeEventListener( types[--i], handler, false );
+ else
+ this.onmousewheel = null;
+ }
+};
+
+$.fn.extend({
+ mousewheel: function(fn) {
+ return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
+ },
+
+ unmousewheel: function(fn) {
+ return this.unbind("mousewheel", fn);
+ }
+});
+
+
+function handler(event) {
+ var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
+
+ event = $.event.fix(event || window.event);
+ event.type = "mousewheel";
+
+ if ( event.wheelDelta ) delta = event.wheelDelta/120;
+ if ( event.detail ) delta = -event.detail/3;
+
+ // Add events and delta to the front of the arguments
+ args.unshift(event, delta);
+
+ return $.event.handle.apply(this, args);
+}
+
+})(jQuery);
\ No newline at end of file
Index: fullcalendar/fullcalendar.js
===================================================================
--- fullcalendar/fullcalendar.js (revision 28)
+++ fullcalendar/fullcalendar.js (working copy)
@@ -60,6 +60,7 @@
var weekStart = (options.weekStart || 0) % 7;
var timeFormat = options.timeFormat || 'gx';
var titleFormat = options.titleFormat || (r2l ? 'Y F' : 'F Y');
+ var enableMouseWheelScroll = typeof options.enableMouseWheelScroll == 'undefined' ? true : options.enableMouseWheelScroll;



@@ -335,6 +336,18 @@
monthElement = $("<div class='full-calendar-month' style='position:relative'/>")
.appendTo($("<div class='full-calendar-month-wrap'/>").appendTo(this));

+ if ($.fn.mousewheel && options.enableMouseWheelScroll !== false) {
+ var prevTimeStamp = 0;
+ $("div.full-calendar-month").map(function() {
+ $(this).mousewheel(function(event, delta) {
+ if (event.timeStamp - prevTimeStamp < 300) return false;
+ delta > 0 ? nextMonth() : prevMonth();
+ event.preventDefault();
+ prevTimeStamp = event.timeStamp;
+ return false;
+ });
+ });
+ }

//
// Build the TABLE cells for the current month. (calls event fetching & rendering code)
Powered by Google Project Hosting