main.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* ========================================================================= */
  2. /*
  3. /*
  4. /******************************* Main Javascript *****************************/
  5. /*
  6. /*
  7. /* ========================================================================= */
  8. $(function(){
  9. /* ============================= Menu item highlighting ============================================ */
  10. jQuery(window).scroll(function () {
  11. if (jQuery(window).scrollTop() > 400) {
  12. jQuery("#navigation").css("background-color","#666");
  13. jQuery("#navigation").addClass("animated-nav");
  14. } else {
  15. jQuery("#navigation").css("background-color","transparent");
  16. jQuery("#navigation").removeClass("animated-nav");
  17. }
  18. });
  19. $('#nav').onePageNav({
  20. filter: ':not(.external)',
  21. scrollSpeed: 950,
  22. scrollThreshold: 1
  23. });
  24. $('#navFoot').onePageNav({
  25. filter: ':not(.external)',
  26. scrollSpeed: 950,
  27. scrollThreshold: 1
  28. });
  29. /* Slider Height
  30. var slideHeight = $(window).height();
  31. $('#home-carousel .carousel-inner .item, #home-carousel .video-container').css('height',slideHeight);
  32. $(window).resize(function(){'use strict',
  33. $('#home-carousel .carousel-inner .item, #home-carousel .video-container').css('height',slideHeight);
  34. });
  35. */
  36. /* ============================= portfolio filtering ============================================ */
  37. $("#projects").mixItUp();
  38. /* ============================= fancybox ============================================ */
  39. $(".fancybox").fancybox({
  40. padding: 0,
  41. openEffect : 'elastic',
  42. openSpeed : 650,
  43. closeEffect : 'elastic',
  44. closeSpeed : 550,
  45. });
  46. /* ============================= count ============================================ */
  47. "use strict";
  48. $(".fact-item").appear(function () {
  49. $(".fact-item [data-to]").each(function () {
  50. var e = $(this).attr("data-to");
  51. $(this).delay(6e3).countTo({
  52. from: 50,
  53. to: e,
  54. speed: 3e3,
  55. refreshInterval: 50
  56. })
  57. })
  58. });
  59. /* ============================= Testimonial ============================================ */
  60. $("#testimonial").owlCarousel({
  61. pagination : true, // Show bullet pagination
  62. slideSpeed : 300,
  63. paginationSpeed : 400,
  64. singleItem:true
  65. });
  66. });
  67. /* ============================= On scroll fade/bounce fffect ============================================ */
  68. wow = new WOW({
  69. animateClass: 'animated',
  70. offset: 100,
  71. mobile: false
  72. });
  73. wow.init();
  74. /* ============================= Progress Bars ============================================ */
  75. initProgress('.progress');
  76. function initProgress(el){
  77. jQuery(el).each(function(){
  78. var pData = jQuery(this).data('progress');
  79. progress(pData,jQuery(this));
  80. });
  81. }
  82. function progress(percent, $element) {
  83. var progressBarWidth = 0;
  84. (function myLoop (i,max) {
  85. progressBarWidth = i * $element.width() / 100;
  86. setTimeout(function () {
  87. $element.find('div').find('small').html(i+'%');
  88. $element.find('div').width(progressBarWidth);
  89. if (++i<=max) myLoop(i,max);
  90. }, 10)
  91. })(0,percent);
  92. }