7.12.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. var $paused = $('ul:paused');
  19. if ($paused.length) {
  20. $paused.cycle('resume');
  21. $.cookie('cyclePaused', null);
  22. }
  23. else {
  24. $(this).effect('shake', {
  25. distance: 10
  26. });
  27. }
  28. }).appendTo($controls);
  29. $books.hover(function() {
  30. $books.find('.title').animate({
  31. backgroundColor: '#eee',
  32. color: '#000'
  33. }, 1000);
  34. }, function() {
  35. $books.find('.title').animate({
  36. backgroundColor: '#000',
  37. color: '#fff'
  38. }, 1000);
  39. });
  40. $('h1').click(function() {
  41. $(this).toggleClass('highlighted', 'slow', 'easeInExpo');
  42. });
  43. $('#books .title').resizable();
  44. });