css - In jQuery UI 1.9 or higher, how to suppress restoring after size effect? -


it seems jquery ui 1.9 or higher restores original size after size effect. sample code here:

http://jsfiddle.net/mqcxy/

$(function () {     $('.circle').click(function () {         $(this).effect("size",             { to: {width: 50,height: 50}, origin: ['bottom', 'right'] },             1000, function () {                 $(this).css({'background': 'blue' });         });     }); }); 

basically, if choose jquery ui 1.8.18 (under jquery 1.7.2), shape shrink right size , stay there. later jquery ui restore shape.

i noticed "origin" options did not take effect higher jquery ui. example, used

origin: ['bottom', 'right'] 

which had no effect jquery ui 1.9 or higher versions.

so how suppress 'restore' , make 'origin' effective in jquery ui 1.8 or later?

a made new function what need fiddle

i changed effect animate , , modifiyng css top+left achive origin functionality, note default goes top-left. ex.

origin => ['bottom'] same ['bottom','left']

origin => ['right'] same ['top','right'] etc..

function size(object,to, origin, duration, callback){     var leftresult = '+=0';     var topresult = '+=0';     if (origin != null && origin.length != 0){         if ($.inarray('right', origin) >= 0){             leftresult= '+='+to.width;         }         if ($.inarray('bottom', origin) >= 0){             topresult= '+='+to.height;         }     }     $(object).animate({         height: to.height,         width: to.width,         left: leftresult,         top: topresult   }, duration, function() {     if (typeof callback == "function") callback($(object));   }); } 

just add validation arguments, or change callback need.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -