Jquery hover - How to make background color animation
-
<div class="post_each"> <h1 class="post_title">Apartamentos 1 comodo</h1> <img class="thumb" src="1.jpg"/> <img class="thumb" src="1.jpg"/> <img class="thumb" src="1.jpg"/> <img class="thumb last" src="1.jpg"/> </div> <div class="post_each"> <h1 class="post_title">Apartamentos 2 comodo</h1> <img class="thumb" src="1.jpg"/> <img class="thumb" src="1.jpg"/> <img class="thumb" src="1.jpg"/> <img class="thumb last" src="1.jpg"/> </div> <script type="text/javascript"> $('img.thumb').hover(function { $(this).animate({"background" : "white"}, 600); }); </script> hover() is not working at all. I just try to set either background color or border size should be increased when mouse hover.
-
Answer:
You can’t animate colors (at least this way), only properties with one numeric value are allowed. There is a separate color animation plugin you need to add. That anonymous function is missing parentheses: $('img.thumb').hover(function () {
user1124927 at Stack Overflow Visit the source
Other answers
You don't need jquery.... .thumb { background: #000; transition: 0.5s; -moz-transition: 0.5s; -webkit-transition: 0.5s; -o-transition: 0.5s;} .thumb:hover { background: #fff; transition: 0.5s; -moz-transition: 0.5s; -webkit-transition: 0.5s; -o-transition: 0.5s;} http://jsfiddle.net/NotInUse/fvac8/
Scott
you can use color plugin.. http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor $('img.thumb').hover(function(){ $(this).animate({ backgroundColor: 'white' }, 600); }); you can also refer previous threads http://stackoverflow.com/questions/425082/jquery-backgroundcolor-animation and http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor
dku.rajkumar
Related Q & A:
- How to change background color in Android application?Best solution by Stack Overflow
- How to make UIImage background color transparent?Best solution by Stack Overflow
- How to draggable button background color to apply another button background?Best solution by Stack Overflow
- How to make the color negative on a PC?Best solution by answers.yahoo.com
- How to make a moving animation?Best solution by goanimate.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.