Problem resizing manually width with the mouse
I have a div, i want to resize it with the mouse clicking the right-border.
I don't want to use jQuery-UI.
So i write my plugin but the function doesn't work.
The code is:
- resizeWidth: function(){
- var coord=null;
- $(this).mousedown(function(e){
- coord={
- x: e.pageX,
- dw: $(this).parent("#uz").width(),
- tw: $(this).parent("uz").children("textarea").width()
- };
- e.preventDefault();
- });
- $(document).mousemove(function(e){
- if (coord){
- // alert(coord.tw);
- $(this).parent("#uz").children("textarea").css("width",coord.tw+(e.pageX-coord.x));
- $(this).parent("#uz").css("width",coord.dw+(e.pageX-coord.x));
- }
- e.preventDefault();
- }).mouseup(function(e){
- coord=null;
- e.preventDefault();
- });
- }
If i uncomment the alert in mousemove handler, i see that the mouseup event is never fired, so there is an alert every movemenet of the mouse.
Using DOMInspector of Chrome there aren't error.
Some help?