JQuery UI show () effect not expected

I am trying to reproduce on show() the same scale effect that is performed on hide() . I use the same parameters, but the effect is not the same:

 $('.div1').show('scale', { direction: "horizontal", duration: 1000 }); $('.div2').hide('scale', { direction: "horizontal", duration: 1000 }); 

http://jsfiddle.net/AUM6d/305/

+6
source share
2 answers

You can use the from attribute and achieve what you want:

 $('.div1').show('scale', { direction: "horizontal" , from: { width: "0"} }, 1000 ); 

This way you say that it starts from width 0 and expands from there.

Fiddle

+4
source

If the effect is acceptable, try the following:

 $('.div1').show('scale', { direction: "both", duration: 1000 }); $('.div2').hide('scale', { direction: "both", duration: 1000 }); 

JSFiddle: http://jsfiddle.net/AUM6d/307/

It is a little different, but it works. From my testing (and the jQueryUI demo page) it looks like this: direction: 'horizontal' is an error.

+1
source

Source: https://habr.com/ru/post/984192/


All Articles