jQuery Resizable: doubling the resize width -


synopsis:

if center resizable element , expand left/right, has illusion expanding half of mouse movement.

reason:

this happens because object centered.

question:

how increase rate object being resized compared mouse movement? centered elements, i'd object expand twice size of mouse distance.

given centered div, best think of set width in callback.

     $('#divid').resizable({             handles       : 'e,w'           , resize        : function (event,ui){                                ui.position.left = ui.originalposition.left;                                ui.size.width    = ( ui.size.width                                                   - ui.originalsize.width )*2                                                   + ui.originalsize.width;                             }      }); 

the above calculates difference between final , original width , multiplies two, adds original width.

i'm not sure best way this. i, one, don't since width being set twice on object. think better way accept sort of (xrate or x-step) , (yrate or y-step) option , include in _mousedrag: portion of jquery function.

to w/o editing jquery, think i'd have create plugin overwrites resizable's _mousedrag function.

i'll accept better answers! :)


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -