1

I have the HTML code

<div class="container">
<div class="content">
<div class="logo"> 
   <a href="http://www.afterquote.com/"> <img src="logo.jpg" alt="logo" /></a>
</div>
<!--logo--> 
</div>
<!--content--> 
</div>
<!--container-->

CSS

.logo.animated {
    border-radius: 50%;
transform: rotate(720deg);
}
.logo {
    height: 80px;
margin: 0 auto;
transition: all 1s ease 0s;
width: 80px;
}
.logo img {
border-radius: 15px;
}

i want to load the .logo.animated class when the page is loaded. please share the jquery code for the same.

1
  • You need to use addClass() Commented Mar 21, 2014 at 9:34

4 Answers 4

3

You can use .addClass() as well as wrapping your code inside $(window).load(function() {...});:

$(window).load(function() {
    $('.logo').addClass('animated');
});
Sign up to request clarification or add additional context in comments.

3 Comments

+1 However seems the OP is looking for $(window).load() because of when the page is loaded.
You're really fast in answering, no room remains for the others :)
Thanks. it make sense. unfortunately the animation is not working after the page load :(
0

you can do using this

$(document).ready(function(){
$('.logo').addClass('animated');
})

Comments

0

As you have image on your page, you would want to wait for the image to be loaded (otherwise you will see animation even if image is not loaded) - In that case you could use

$(window).load(function(){
  $('.logo').addClass('animated');
});

Comments

0

You can use the below:

either :

$(function() {
$('.logo').addClass('animated');
});

Or:

window.load(function(){
$('.logo').addClass('animated');
})

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.