home.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. $(document).ready(function(){
  2. new WOW().init();
  3. $('.top-left-image').css('opacity','1');
  4. $(".home-step-wave").click(function(event) {
  5. var position = $(this).offset().top;
  6. $('html').animate({
  7. scrollTop: position
  8. });
  9. });
  10. setInterval(function(){
  11. nextStudent();
  12. }, 4000);
  13. })
  14. var tag = document.createElement('script');
  15. tag.src = "https://www.youtube.com/iframe_api";
  16. var firstScriptTag = document.getElementsByTagName('script')[0];
  17. firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  18. var player;
  19. function onYouTubeIframeAPIReady() {
  20. player = new YT.Player('video-player', {
  21. videoId: 'Fd7xJx4Qf9Q',
  22. height: '100%',
  23. width: '100%',
  24. playerVars: {
  25. autoplay: 0,
  26. controls: 0,
  27. showinfo: 0,
  28. playsinline: 1,
  29. rel: 0
  30. },
  31. events: {
  32. // 'onReady': onPlayerReady,
  33. // 'onStateChange': onPlayerStateChange
  34. }
  35. });
  36. $(document).on('click', '.home-method .method-video .video-layout', function(){
  37. if(player.getPlayerState() == 1){
  38. player.pauseVideo();
  39. $(".home-method .method-video .video-layout").removeClass('hide-layout');
  40. }else{
  41. player.playVideo();
  42. $(".home-method .method-video .video-layout").addClass('hide-layout');
  43. }
  44. });
  45. }
  46. var checkClick = 1;
  47. var timeEffectNext = 500;
  48. function nextStudent(){
  49. if ( checkClick == 1 ){
  50. checkClick = 0;
  51. var divCur = $('.home-student-info.info-active');
  52. var divNext = $(divCur).next('.home-student-info');
  53. if ( divNext.length == 0 ){
  54. divNext = $('.home-student-info:first-child');
  55. }
  56. if ( !$(divNext).is(divCur) ){
  57. // Effect
  58. $(divCur).animate({
  59. left: "-100%",
  60. },{
  61. duration: timeEffectNext,
  62. complete: function() {
  63. $(divCur).css("display", "none");
  64. }
  65. });
  66. $(divNext).css({
  67. display: "block",
  68. left: "100%",
  69. });
  70. $(divNext).animate({
  71. left: "0%",
  72. },{
  73. duration: timeEffectNext,
  74. complete: function() {
  75. // Effect next complete
  76. checkClick = 1;
  77. divCur.removeClass('info-active');
  78. divNext.addClass('info-active');
  79. }
  80. });
  81. // End Effect
  82. }
  83. }
  84. }