javascript - How to transition element when changing its relative top? -


in jquery change elements position (which has relative positioning) $(elem).css("top",x);. how can , animate or transition it, moves new location fast not instantly.

thanks.

two ways :

1 . can use jquery animate() :

demo : http://jsfiddle.net/5pvww/

learn more jquery animate() function here .

2 . can use css transition :

demo : http://jsfiddle.net/eebdh/

learn more transition in tutorial .


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -