d
Amit DhamuSoftware Engineer
 

Hover Animations

1 minute read 00000 views
// Animates all anchor tags to animate to 50% opacity on hover
$('a').hover(
  function () {
    $(this).stop().animate({ opacity: '.5' }, 'fast')
  },
  function () {
    $(this).stop().animate({ opacity: '1' }, 'fast')
  }
)

// Animates background colour of all divs on hover - jQuery UI plugin required for animating colour.
$('div').hover(
  function () {
    $(this).stop().animate({ backgroundColor: '#fe0000' }, 'fast')
  },
  function () {
    $(this).stop().animate({ backgroundColor: '#ffffff' }, 'fast')
  }
)