/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
click ---------------------- $('#target').click(function() { alert('Handler for .click() called.'); }); hover ---------------------- $("li").hover( function () { $(this).append($("<span> ***</span>")); }, function () { $(this).find("span:last").remove(); } ); animate ---------------------- $('#clickme').click(function() { $('#book').animate({ opacity: 0.25, left: '+=50', height: 'toggle' }, 5000, function() { // Animation complete. }); }); $('img.selector_tab').animate({ marginLeft: 225 }, 350, function() { // Callback $('.opt.existing').css('color', '#a60e00'); }); Animate margin top on hover $('.footerRibbon').hover( function() { $('.footerBook').animate({ marginTop: '-220px' }, 250, "swing" ); }, function() { $('.footerBook').animate({ marginTop: '-170px' }, 250, "swing" ); });
Comments
