Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. ;
  2. (function($) {
  3.  
  4. $(document).ready(function() {
  5. var l = 0;
  6. // document.getElementById("liZero").addEventListener("click", function(){replaceText(0);});
  7. var item = document.getElementsByClassName("item");
  8. for (var i = 0; i < item.length; i++) {
  9. item[i].addEventListener("click", function(){replaceText(i);});
  10. }
  11. $(".carousel-control-next").click(function() {
  12. l++;
  13. if (l > 4) {
  14. l = 0;
  15. }
  16. replaceText(l);
  17. });
  18. $(".carousel-control-prev").click(function() {
  19. l--;
  20. if (l < 0) {
  21. l = 4;
  22. }
  23. replaceText(l);
  24. });
  25.  
  26. function replaceText($i) {
  27. $(".carousel-caption, .about").slideUp(500, function() {
  28.  
  29.  
  30. switch ($i) {
  31. case 0:
  32. $('.carousel-caption').text('Open in theaters October 9th');
  33. break;
  34. case 1:
  35. $('.carousel-caption').text("Airs March 7th");
  36. break;
  37. case 2:
  38. $('.carousel-caption').text("In theaters November 21st");
  39. break;
  40. case 3:
  41. $('.carousel-caption').text("Airs July 24th");
  42. break;
  43. case 4:
  44. $('.carousel-caption').text("Airs January 2nd");
  45. break;
  46. default:
  47. $('.carousel-caption').text("Error");
  48. }
  49.  
  50. $(".carousel-caption, .about").slideDown();
  51. });
  52. }
  53.  
  54.  
  55. /*
  56. $(".carousel-control-next").click(function(){
  57. $(".carousel-caption").slideUp();
  58. });
  59. */
  60. });
  61. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement