Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Rotate div on page load Re: Rotate div on page load

#140637
pixelgrid
Participant

1 -make a class holding the animation declaration.

2 – on page load add that class to the element you want

3 – enjoy the magic.

//CSS
.className{
animation:turn 1s linear;
}

@keyframes turn{
100%{transform:rotate(360deg)}
}
//jQuery
$(function(){
$(‘.myElement’).addClass(‘className’);
});

note that animation keyframes and transform require vendor prefixes