studio.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. new WOW().init();
  2. jQuery(document).ready(function($) {
  3. $(window).bind('load', function() {
  4. $('#loader').fadeOut(100);
  5. });
  6. $('.nav-toggle').on('touchstart click', function(e) {
  7. e.preventDefault();
  8. $( this ).toggleClass( 'active' );
  9. });
  10. $(function dw_hidenav() {
  11. var headerHeight = $('.navbar').height();
  12. $(window).on('scroll', { previousTop: 0 },
  13. function() {
  14. var currentTop = $(window).scrollTop();
  15. if (currentTop < this.previousTop) {
  16. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  17. $('.navbar').addClass('visible');
  18. $('.site-title a').removeClass('light');
  19. } else {
  20. $('.navbar').removeClass('visible fixed');
  21. $('.site-title a').addClass('light');
  22. }
  23. }
  24. else {
  25. $('.navbar').removeClass('visible');
  26. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  27. }
  28. this.previousTop = currentTop;
  29. }
  30. );
  31. });
  32. $('.caro-grad').appear();
  33. $('.caro-grad').one('appear', dw_appear);
  34. function dw_appear() {
  35. $('#caro').carousel({
  36. interval: 7000,
  37. wrap: true,
  38. pause: false,
  39. keyboard: true
  40. });
  41. var anima = new DrawFillSVG({elementId: 'svg-imac'});
  42. anima.replay();
  43. };
  44. $(document).bind('keyup', function(e) {
  45. if(e.which === 39){
  46. $('#caro').carousel('next');
  47. }
  48. else if(e.which === 37){
  49. $('#caro').carousel('prev');
  50. }
  51. });
  52. $('#caro').on('slid.bs.carousel', function(event) {
  53. var consta = $(event.target);
  54. setTimeout(function() {
  55. if (consta.find('.item.active').data('id') === 1) {
  56. $('#studio-caro').addClass('caro-grad').removeClass('caro-grad3 caro-grad2');
  57. }
  58. if (consta.find('.item.active').data('id') === 2) {
  59. $('#studio-caro').removeClass('caro-grad caro-grad3').addClass('caro-grad2');
  60. }
  61. if (consta.find('.item.active').data('id') === 3) {
  62. $( '#studio-caro' ).addClass('caro-grad3').removeClass('caro-grad2 caro-grad');
  63. }
  64. }, 10);
  65. });
  66. $('#caro').on('slid.bs.carousel', function() {
  67. $('.active .animac').removeClass('hide-svg fade-svg');
  68. var animac = new DrawFillSVG({elementId: 'svg-imac'});
  69. var animac1 = new DrawFillSVG({elementId: 'sv'});
  70. var animac2 = new DrawFillSVG({elementId: 'svg-mac'});
  71. animac.replay();
  72. animac1.replay();
  73. animac2.replay();
  74. });
  75. $('#caro').on('slide.bs.carousel', function() {
  76. $('.active #svg-imac.bg').attr('class', 'svg screen');
  77. $('.active .animac').addClass('fade-svg').delay(1000).queue(function(hideit){
  78. $(this).addClass('hide-svg');
  79. hideit();
  80. });
  81. });
  82. $('#caro').on('slid.bs.carousel', function() {
  83. $('.active #svg-imac.screen').delay(2500).queue(function(screenit){
  84. $(this).attr('class', 'bg');
  85. screenit();
  86. });
  87. });
  88. });