7.15.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }).button({
  16. icons: {primary: 'ui-icon-pause'}
  17. }).appendTo($controls);
  18. $('<button>Resume</button>').click(function(event) {
  19. event.preventDefault();
  20. var $paused = $('ul:paused');
  21. if ($paused.length) {
  22. $paused.cycle('resume');
  23. $.cookie('cyclePaused', null);
  24. }
  25. else {
  26. $(this).effect('shake', {
  27. distance: 10
  28. });
  29. }
  30. }).button({
  31. icons: {primary: 'ui-icon-play'}
  32. }).appendTo($controls);
  33. $books.hover(function() {
  34. $books.find('.title').animate({
  35. backgroundColor: '#eee',
  36. color: '#000'
  37. }, 1000);
  38. }, function() {
  39. $books.find('.title').animate({
  40. backgroundColor: '#000',
  41. color: '#fff'
  42. }, 1000);
  43. });
  44. $('h1').click(function() {
  45. $(this).toggleClass('highlighted', 'slow', 'easeInExpo');
  46. });
  47. $books.find('.title').resizable({
  48. handles: 's'
  49. });
  50. });