Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. $('#slider_bx').bxSlider({
  2. mode: 'fade',
  3. speed: 1000,
  4. pause: 9000,
  5. auto: true,
  6. autoControls: false,
  7. prevText: '',
  8. nextText: '',
  9. autoHover: true,
  10. captions: false,
  11. pager: true,
  12. onBeforeSlide: function () {
  13. if ($('.slide_in').length) {
  14. $('.slide_in').hide();
  15. }
  16. },
  17. onAfterSlide: function () {
  18. if ($('.slide_in').length && $('.slide_in').is(':hidden')) {
  19. doCrazyStuff();
  20. }
  21. }
  22. });
  23.  
  24. function doCrazyStuff() {
  25. var $this = $('.slide_in');
  26. if ($this.length > 0) {
  27. setTimeout(function () {
  28. $this.show();
  29. $this.rotate({
  30. duration: 2000,
  31. angle: 90,
  32. animateTo: -20
  33. });
  34. }, 3000);
  35. }
  36. }
  37.  
  38. $this.show().stop();
  39. $this.stop().show();
  40. $this.stop().rotate({
  41. duration: 2000,
  42. angle: 90,
  43. animateTo: -20
  44. });
  45.  
  46. $this.rotate({
  47. duration: 2000,
  48. angle: 90,
  49. animateTo: -20
  50. }).stop(); // throws an error
  51.  
  52. var crazyTimeout;
  53. function doCrazyStuff() {
  54. var $this = $('.slide_in');
  55. if ($this.length > 0) {
  56. if (crazyTimeout != undefined) {
  57. clearTimeout(crazyTimeout); // Cancel previous timeout
  58. }
  59. crazyTimeout = setTimeout(function () {
  60. crazyTimeout = undefined;
  61. $this.show();
  62. $this.rotate({
  63. duration: 2000,
  64. angle: 90,
  65. animateTo: -20
  66. });
  67. }, 3000);
  68. }
  69. }
  70.  
  71. var crazyTimeout;
  72. function doCrazyStuff() {
  73. var $this = $('.slide_in');
  74. if ($this.length > 0) {
  75. if (crazyTimeout != undefined) {
  76. return; // A timeout is still running: don't create new one
  77. }
  78. crazyTimeout = setTimeout(function () {
  79. crazyTimeout = undefined;
  80. $this.show();
  81. $this.rotate({
  82. duration: 2000,
  83. angle: 90,
  84. animateTo: -20
  85. });
  86. }, 3000);
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement