7.9.js 957 B

12345678910111213141516171819202122232425262728293031323334353637
  1. $(document).ready(function() {
  2. var $books = $('#books').cycle({
  3. timeout: 2000,
  4. speed: 200,
  5. pause: true
  6. });
  7. if ( $.cookie('cyclePaused') ) {
  8. $books.cycle('pause');
  9. }
  10. var $controls = $('<div id="books-controls"></div>').insertAfter($books);
  11. $('<button>Pause</button>').click(function(event) {
  12. event.preventDefault();
  13. $books.cycle('pause');
  14. $.cookie('cyclePaused', 'y');
  15. }).appendTo($controls);
  16. $('<button>Resume</button>').click(function(event) {
  17. event.preventDefault();
  18. $('ul:paused').cycle('resume');
  19. $.cookie('cyclePaused', null);
  20. }).appendTo($controls);
  21. $books.hover(function() {
  22. $books.find('.title').animate({
  23. backgroundColor: '#eee',
  24. color: '#000'
  25. }, 1000);
  26. }, function() {
  27. $books.find('.title').animate({
  28. backgroundColor: '#000',
  29. color: '#fff'
  30. }, 1000);
  31. });
  32. $('h1').click(function() {
  33. $(this).toggleClass('highlighted', 'slow');
  34. });
  35. });