[PLUGINS] +crayons
[lhc/web/clavette_www.git] / www / plugins / crayons / js / resizehandle.js
1 (function($){
2 /*
3 * resizehandle.js (c) Fil 2007-2011, plugin pour jQuery
4 * @ http://www.jquery.info/spip.php?article44
5 * Distribue sous licence GNU/LGPL et MIT
6 */
7 $.fn.resizehandle = function() {
8 return this.each(function() {
9 var me = $(this);
10 me.after(
11 $('<div class="resizehandle"></div>')
12 .css({height:'16px',width:Math.max(me.width()-4,10)}) // bug MSIE si 100%
13 .bind('mousedown', function(e) {
14 var h = me.height();
15 var y = e.clientY;
16 var moveHandler = function(e) {
17 me
18 .height(Math.max(20, e.clientY + h - y));
19 };
20 var upHandler = function(e) {
21 $('html')
22 .unbind('mousemove',moveHandler)
23 .unbind('mouseup',upHandler);
24 };
25 $('html')
26 .bind('mousemove', moveHandler)
27 .bind('mouseup', upHandler);
28 })
29 );
30 });
31 };
32 })(jQuery);