4.13.js 789 B

12345678910111213141516171819202122232425262728293031
  1. $(document).ready(function() {
  2. var $speech = $('div.speech');
  3. var defaultSize = $speech.css('fontSize');
  4. $('#switcher button').click(function() {
  5. var num = parseFloat($speech.css('fontSize'));
  6. switch (this.id) {
  7. case 'switcher-large':
  8. num *= 1.4;
  9. break;
  10. case 'switcher-small':
  11. num /= 1.4;
  12. break;
  13. default:
  14. num = parseFloat(defaultSize);
  15. }
  16. $speech.css('fontSize', num + 'px');
  17. });
  18. var $firstPara = $('p').eq(1);
  19. $firstPara.hide();
  20. $('a.more').click(function(event) {
  21. event.preventDefault();
  22. $firstPara.animate({height: 'toggle'}, 'slow');
  23. var $link = $(this);
  24. if ($link.text() == 'read more') {
  25. $link.text('read less');
  26. } else {
  27. $link.text('read more');
  28. }
  29. });
  30. });