Posted By

LeeRJohnson on 10/20/09


Tagged

hover fade animation ui


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

StrawMan
wizard04
f6design


Greyscale Hover Effect w/ CSS


 / Published in: jQuery
 

URL: http://www.sohtanaka.com/web-design/greyscale-hover-effect-w-css-jquery/

  1. $(document).ready(function() {
  2.  
  3. $("ul.gallery li").hover(function() { //On hover...
  4.  
  5. var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
  6.  
  7. //Set a background image(thumbOver) on the <a> tag - Set position to bottom
  8. $(this).find("a.thumb").css({'background' : 'url(' thumbOver ') no-repeat center bottom'});
  9.  
  10. //Animate the image to 0 opacity (fade it out)
  11. $(this).find("span").stop().fadeTo('normal', 0 , function() {
  12. $(this).hide() //Hide the image after fade
  13. });
  14. } , function() { //on hover out...
  15. //Fade the image to full opacity
  16. $(this).find("span").stop().fadeTo('normal', 1).show();
  17. });

Report this snippet  

You need to login to post a comment.