lib-jquery-learning-code-04-gettysburg.js / js
document.ready(function() { var speech.css('fontSize'); $('#switcher button').click(function() { var num = parseFloat( // if (this.id == 'switcher-large') { // num *= 1.4; // } else if (this.id == 'switcher-small') { // num /= 1.4; // } speech.animate({fontSize: num + 'px'}, 'slow'); }); }); // document.ready(function() { // var // firstPara.hide(); // $('a.more').click(function() { // if ( // firstPara.fadeIn('slow'); // this.text('read less'); // } else { // // this.text('read more'); // } // return false; // }); // }); document.ready(function() { var firstPara = $('p:eq(1)'); firstPara.slideToggle('slow'); var link.text() == "read more" ) { link.text('read more'); } return false; }); }); // document.ready(function() { // // var // firstPara.hide(); // $('a.more').click(function() { // var // firstPara.animate({ // opacity: 'toggle', // height: 'toggle' // }, // 'slow' // ); // if ( // link.text('read less'); // } else { // // } // return false; // }); // // }); // document.ready(function() { // $('div.label').click(function() { // var paraWidth = $('div.speech p').outerWidth(); // var switcher = this.parent(); // var switcherWidth = // switcher.animate({ // 'left': paraWidth - switcherWidth, // height: '+=20px', // borderWidth: '5px' // }, 'slow'); // // }); // }); // document.ready(function() { // $('div.label').click(function() { // var paraWidth = $('div.speech p').outerWidth(); // var // var switcherWidth = switcher.outerWidth(); // // .animate({left: paraWidth - switcherWidth}, 'slow') // .animate({height: '+=20px'}, 'slow') // .animate({borderWidth: '5px'}, 'slow'); // }); // }); document.ready(function() { $('div.label').click(function() { var paraWidth = $('div.speech p').outerWidth(); var switcher = this.parent(); var switcherWidth = switcher .fadeTo('fast',0.5) .animate({ 'left': paraWidth - switcherWidth }, 'slow') .fadeTo('slow',1.0) .slideUp('slow', function() { // document.ready(function() { // $('p:eq(2)') // .css('border', '1px solid #333') // .click(function() { // this.slideUp('slow') // .next().slideDown('slow'); // }); // $('p:eq(3)').css('backgroundColor', '#ccc').hide(); // }); document.ready(function() { var thirdPara = $('p:eq(2)'); thirdPara.slideUp('slow'); }); }); $('p:eq(3)').css('backgroundColor', '#ccc').hide(); }); // Make clickable elements appear so on hover. document.ready(function() { $('h2, div.button, div.label, span.more').hover(function() { this.addClass('hover'); }, function() { this.removeClass('hover'); }); });
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.