Dodanie biblioteki jquery.resizable.js pozwalającej na zmianę wielkości paska boczneg...
[redakcja.git] / project / static / js / jquery.resizable.js
diff --git a/project/static/js/jquery.resizable.js b/project/static/js/jquery.resizable.js
new file mode 100644 (file)
index 0000000..415aa2d
--- /dev/null
@@ -0,0 +1,31 @@
+(function($){
+    $.resizable = {
+        element: {},
+        drag: function(event) {
+            $.resizable.element.element.css({
+                width: Math.max(event.pageX - $.resizable.element.mouseX + $.resizable.element.width, 0)
+            })
+            $.resizable.element.element.trigger('resizable:resize');
+            return false;
+        },
+        stop: function() {
+            $.resizable.element.element.trigger('resizable:stop');
+            $().unbind('mousemove', $.resizable.drag).unbind('mouseup', $.resizable.stop);
+            return false;
+        }
+    };
+    
+    $.fn.resizable = function(handle) {
+        var element = $(this);
+        $(handle, element).mousedown(function(event) {
+            var position = element.position();
+            $.resizable.element = {
+                element: element,
+                width: parseInt(element.css('width')) || element[0].scrollWidth || 0,
+                mouseX: event.pageX,
+            };
+            $().mousemove($.resizable.drag).mouseup($.resizable.stop);
+        });
+    };
+})(jQuery);
+