studio.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. jQuery(document).ready(function($) {
  2. $(window).bind('load', function() {
  3. $('#loader').fadeOut(2000);
  4. });
  5. $('.nav-toggle').on('touchstart click', function(e) {
  6. e.preventDefault();
  7. $( this ).toggleClass( 'active' );
  8. });
  9. new WOW().init();
  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').carousel({
  33. interval: 5000,
  34. wrap: true,
  35. });
  36. $(document).bind('keyup', function(e) {
  37. if (e.which === 39){
  38. $('#caro').carousel('next');
  39. }
  40. else if(e.which === 37){
  41. $('#caro').carousel('prev');
  42. }
  43. });
  44. $('.studio-subnav a').click(function (e) {
  45. e.preventDefault()
  46. $(this).tab('show')
  47. })
  48. $("#studio-caro").backstretch("../wp-content/themes/daw/img/desk2.jpg");
  49. $('#caro').on('slid.bs.carousel', function(event) {
  50. var consta = $('#caro li.active');
  51. //console.log('target: ' + consta.data('target') + ' value: ' + consta.data('value') + ' slide-to: ' + consta.data('slideTo'));
  52. //var consta = $(event.target);
  53. setTimeout(function() {
  54. if (consta.data('slideTo') === 0) {
  55. $('.studio-subnav a[href="#studio"]').tab('show')
  56. $('#studio-caro').addClass('caro-grad5').removeClass('caro-grad caro-grad3 caro-grad2 caro-grad5');
  57. $('.site-title a').addClass('light');
  58. $('.carousel-indicators li').removeClass('darken-carousel-indicators');
  59. $("#studio-caro").backstretch({url:'../wp-content/themes/daw/img/desk2.jpg', fade: 250 });
  60. }
  61. if (consta.data('slideTo') === 1) {
  62. $('.studio-subnav a[href="#webdev"]').tab('show')
  63. $('.active #svg-imac.screen').delay(2500).queue(function(screenit){
  64. $(this).attr('class', 'bg');
  65. screenit();
  66. });
  67. $('#studio-caro').addClass('caro-grad').removeClass('caro-grad3 caro-grad2 caro-grad5');
  68. $('.site-title a').addClass('light');
  69. $('.carousel-indicators li').removeClass('darken-carousel-indicators');
  70. $("#studio-caro").backstretch('destroy');
  71. }
  72. if (consta.data('slideTo') === 2) {
  73. $('.studio-subnav a[href="#ux"]').tab('show')
  74. $('#studio-caro').addClass('caro-grad2').removeClass('caro-grad caro-grad3 caro-grad5');
  75. $('.site-title a').addClass('light');
  76. $('.carousel-indicators li').removeClass('darken-carousel-indicators');
  77. $("#studio-caro").backstretch('destroy');
  78. }
  79. if (consta.data('slideTo') === 3) {
  80. $('.studio-subnav a[href="#graphic"]').tab('show')
  81. $( '#studio-caro' ).addClass('caro-grad3').removeClass('caro-grad2 caro-grad caro-grad5');
  82. $('.site-title a').removeClass('light');
  83. $('.carousel-indicators li').addClass('darken-carousel-indicators');
  84. $("#studio-caro").backstretch('destroy');
  85. }
  86. if (consta.data('slideTo') === 4) {
  87. $('.studio-subnav a[href="#media"]').tab('show')
  88. $('#studio-caro').removeClass('caro-grad caro-grad3').addClass('caro-grad5');
  89. $('.site-title a').addClass('light');
  90. $('.carousel-indicators li').removeClass('darken-carousel-indicators');
  91. $("#studio-caro").backstretch({isVideo: true, url:'../wp-content/themes/dw/img/camera.mp4', poster:'../wp-content/themes/dw/img/camera.jpg'});
  92. }
  93. if (consta.data('slideTo') === 5) {
  94. $('.studio-subnav a[href="#art"]').tab('show')
  95. $( '#studio-caro' ).addClass('caro-grad5').removeClass('caro-grad2 caro-grad caro-grad3');
  96. $('.site-title a').addClass('light');
  97. $('.carousel-indicators li').removeClass('darken-carousel-indicators');
  98. $("#studio-caro").backstretch({url:'../wp-content/themes/dw/img/paints2.jpg', fade: 250 });
  99. }
  100. }, 10);
  101. });
  102. $('#caro').on('slide.bs.carousel', function() {
  103. $('.active #svg-imac.bg').attr('class', 'svg screen');
  104. $('.active .animac').addClass('fade-svg').delay(1000).queue(function(hideit){
  105. $(this).addClass('hide-svg');
  106. hideit();
  107. });
  108. });
  109. $('#caro').on('slid.bs.carousel', function() {
  110. $('.active .animac').removeClass('hide-svg fade-svg');
  111. var animac = new DrawFillSVG({elementId: 'svg-imac'});
  112. var animac1 = new DrawFillSVG({elementId: 'sv'});
  113. var animac2 = new DrawFillSVG({elementId: 'svg-mac'});
  114. var animac3 = new DrawFillSVG({elementId: 'svg-device'});
  115. animac.replay();
  116. animac1.replay();
  117. animac2.replay();
  118. animac3.replay();
  119. });
  120. });