I am trying to implement rotate animation its working but I want to change the div position. Here is my code:-
$(function(){
var el=$('div');
el.animate({ deg: 180 }, {
duration: 1000,
step: function (now) {
el.css({
transform: 'rotate(' + now + 'deg)'
});
},
complete: function () {
},
});
});
I want this position(now its first but I want second):-
Thanks for your hepl
Use translateY(-100%)
$(function(){
var el=$('div');
el.animate({ deg: 180 }, {
duration: 1000,
step: function (now) {
el.css({
transform: 'rotate(' + now + 'deg) translateY(-100%)'
});
},
complete: function () {
},
});
});
$(function(){
var el=$('div');
var topik = $('div').css('top');
el.animate({ deg: 180 }, {
duration: 1000,
step: function (now) {
el.css({
transform: 'rotate(' + now + 'deg)',
top : topik+'500px',
});
},
complete: function () {
},
});
})
Dont thank me ;););)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.