Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post

    Jquery hover. How to make it work!

    Code:
    <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>
    The hover function isnt working.

    Appreciate who can help me figure out this.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,695
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    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.

  • #3
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    That anonymous function is missing parentheses:
    Code:
    $('img.thumb').hover(function () {
    Also, jQuery doesn't animate color values — you will need a plugin for that.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

  • Users who have thanked venegal for this post:

    sorlaker (12-21-2011)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •