custom.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // Custom Script
  2. // Developed by: Samson.Onna
  3. // CopyRights : http://webthemez.com
  4. var customScripts = {
  5. profile: function () {
  6. var portfolio = $('#portfolio');
  7. var items = $('.items', portfolio);
  8. var filters = $('.filters li a', portfolio);
  9. items.imagesLoaded(function () {
  10. items.isotope({
  11. itemSelector: '.item',
  12. layoutMode: 'fitRows',
  13. transitionDuration: '0.7s'
  14. });
  15. });
  16. filters.click(function () {
  17. var el = $(this);
  18. filters.removeClass('active');
  19. el.addClass('active');
  20. var selector = el.attr('data-filter');
  21. items.isotope({filter: selector});
  22. return false;
  23. });
  24. },
  25. fancybox: function () {
  26. // fancybox
  27. $(".fancybox").fancybox();
  28. },
  29. onePageNav: function () {
  30. $('#mainNav').onePageNav({
  31. currentClass: 'active',
  32. changeHash: false,
  33. scrollSpeed: 950,
  34. scrollThreshold: 0.2,
  35. filter: '',
  36. easing: 'swing',
  37. begin: function () {
  38. //I get fired when the animation is starting
  39. },
  40. end: function () {
  41. //I get fired when the animation is ending
  42. if (!$('#main-nav ul li:first-child').hasClass('active')) {
  43. $('.header').addClass('addBg');
  44. } else {
  45. $('.header').removeClass('addBg');
  46. }
  47. },
  48. scrollChange: function ($currentListItem) {
  49. //I get fired when you enter a section and I pass the list item of the section
  50. if (!$('#main-nav ul li:first-child').hasClass('active')) {
  51. $('.header').addClass('addBg');
  52. } else {
  53. $('.header').removeClass('addBg');
  54. }
  55. }
  56. });
  57. $("a[href='#top']").click(function () {
  58. $("html, body").animate({scrollTop: 0}, "slow");
  59. return false;
  60. });
  61. $("a[href='#basics']").click(function () {
  62. $("html, body").animate({scrollTop: $('#services').offset().top - 75}, "slow");
  63. return false;
  64. });
  65. },
  66. owlSlider: function () {
  67. var owl = $("#owl-demo");
  68. owl.owlCarousel();
  69. // Custom Navigation Events
  70. $(".next").click(function () {
  71. owl.trigger('owl.next');
  72. })
  73. $(".prev").click(function () {
  74. owl.trigger('owl.prev');
  75. })
  76. },
  77. bannerHeight: function () {
  78. var bHeight = $(".banner-container").height();
  79. $('#da-slider').height(bHeight);
  80. $(window).resize(function () {
  81. var bHeight = $(".banner-container").height();
  82. $('#da-slider').height(bHeight);
  83. });
  84. },
  85. waySlide: function () {
  86. /* Waypoints Animations
  87. ------------------------------------------------------ */
  88. $('.design').waypoint(function () {
  89. $('.design').addClass('animated fadeInUp show');
  90. }, {offset: 'bottom-in-view'});
  91. },
  92. fitText: function () {
  93. setTimeout(function () {
  94. $('h1.responsive-headline').fitText(1.2, {minFontSize: '16px', maxFontSize: '30px'});
  95. }, 100);
  96. },
  97. init: function () {
  98. customScripts.onePageNav();
  99. customScripts.profile();
  100. customScripts.fancybox();
  101. customScripts.owlSlider();
  102. customScripts.waySlide();
  103. customScripts.fitText();
  104. customScripts.bannerHeight();
  105. }
  106. }
  107. $('document').ready(function () {
  108. customScripts.init();
  109. });