Jump to content
Sign in to follow this  
Eyad Syria-lover

Can't Animate Background Image Using jQuery Library

Recommended Posts

This Code Isn't Working:

 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

 

<script>

$(document).ready(function(){

$("#area").animate({

backgroundImage:"url('image2.png')"

},2000);

});

</script>

 

<style>

#area

{

width:100%;

height:600px;

background-image:url("image2.png");

}

</style>

 

<div id="area"></div>

Share this post


Link to post
Share on other sites

I'm not sure what you expected it to do. You can't animate background images, you can only animate properties with numbers as values. (colors are also numbers)

 

 

Here's a list of properties that can be animated: http://www.w3schools.com/cssref/css_animatable.asp

jQuery is capable of animating a few Javascript properties which aren't on that list, such as scrollTop.

Edited by Ingolme
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...