This is a random list of jQuery code that roughly reflects real life.

Follow me on twitter @reallifejquery Follow reallifejquery on Twitter


Tuesday, May 18, 2010

How mice affect our lives

$('#MyHouse').mouseenter(function () {
   $('.cheese').slice(2);
   $('.mousetrap').add('.cheese');
   $('.mousetrap').position();
   $('.mousetrap #armed').toggle();
   $('.mousetrap').click(function() {
      if ($('.mousetrap').has('.mouse')) {
         $(this).remove('.mouse');
      }
      else if (!$('.mousetrap').has('.cheese')) {
         $('.cheese').slice(2);
         $('.mousetrap').add('.cheese');
      }
      $('.mousetrap #armed').toggle();
   });
});


$('#MyHouse').mouseleave(function () {
   $('.mousetrap').remove();
});

No comments:

Post a Comment