main.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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","#E7EF4A");
  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. /* Slider Height
  25. var slideHeight = $(window).height();
  26. $('#home-carousel .carousel-inner .item, #home-carousel .video-container').css('height',slideHeight);
  27. $(window).resize(function(){'use strict',
  28. $('#home-carousel .carousel-inner .item, #home-carousel .video-container').css('height',slideHeight);
  29. });
  30. */
  31. /* ============================= portfolio filtering ============================================ */
  32. $("#projects").mixItUp();
  33. /* ============================= fancybox ============================================ */
  34. $(".fancybox").fancybox({
  35. padding: 0,
  36. openEffect : 'elastic',
  37. openSpeed : 650,
  38. closeEffect : 'elastic',
  39. closeSpeed : 550,
  40. });
  41. /* ============================= count ============================================ */
  42. "use strict";
  43. $(".fact-item").appear(function () {
  44. $(".fact-item [data-to]").each(function () {
  45. var e = $(this).attr("data-to");
  46. $(this).delay(6e3).countTo({
  47. from: 50,
  48. to: e,
  49. speed: 3e3,
  50. refreshInterval: 50
  51. })
  52. })
  53. });
  54. /* ============================= Testimonial ============================================ */
  55. $("#testimonial").owlCarousel({
  56. pagination : true, // Show bullet pagination
  57. slideSpeed : 300,
  58. paginationSpeed : 400,
  59. singleItem:true
  60. });
  61. });
  62. /* ============================= On scroll fade/bounce fffect ============================================ */
  63. wow = new WOW({
  64. animateClass: 'animated',
  65. offset: 100,
  66. mobile: false
  67. });
  68. wow.init();
  69. /* ============================= Progress Bars ============================================ */
  70. initProgress('.progress');
  71. function initProgress(el){
  72. jQuery(el).each(function(){
  73. var pData = jQuery(this).data('progress');
  74. progress(pData,jQuery(this));
  75. });
  76. }
  77. function progress(percent, $element) {
  78. var progressBarWidth = 0;
  79. (function myLoop (i,max) {
  80. progressBarWidth = i * $element.width() / 100;
  81. setTimeout(function () {
  82. $element.find('div').find('small').html(i+'%');
  83. $element.find('div').width(progressBarWidth);
  84. if (++i<=max) myLoop(i,max);
  85. }, 10)
  86. })(0,percent);
  87. }