custom.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*-------------------------------------------------------------------------------
  2. PRE LOADER
  3. -------------------------------------------------------------------------------*/
  4. $(window).load(function(){
  5. $('.preloader').fadeOut(1000); // set duration in brackets
  6. });
  7. /* HTML document is loaded. DOM is ready.
  8. -------------------------------------------*/
  9. $(document).ready(function() {
  10. /*-------------------------------------------------------------------------------
  11. Isotope Filter - Portfolio Section
  12. -------------------------------------------------------------------------------*/
  13. jQuery(document).ready(function($){
  14. if ( $('.work-box-wrapper').length > 0 ) {
  15. var $container = $('.work-box-wrapper'),
  16. $imgs = $('.work-box img');
  17. $container.imagesLoaded(function () {
  18. $container.isotope({
  19. layoutMode: 'masonry',
  20. itemSelector: '.work-box'
  21. });
  22. $imgs.load(function(){
  23. $container.isotope('reLayout');
  24. })
  25. });
  26. //filter items on button click
  27. $('.filter-wrapper li a').click(function(){
  28. var $this = $(this), filterValue = $this.attr('data-filter');
  29. $container.isotope({
  30. filter: filterValue,
  31. animationOptions: {
  32. duration: 750,
  33. easing: 'linear',
  34. queue: false,
  35. }
  36. });
  37. // don't proceed if already selected
  38. if ( $this.hasClass('selected') ) {
  39. return false;
  40. }
  41. var filter_wrapper = $this.closest('.filter-wrapper');
  42. filter_wrapper.find('.selected').removeClass('selected');
  43. $this.addClass('selected');
  44. return false;
  45. });
  46. }
  47. });
  48. /*-------------------------------------------------------------------------------
  49. Hide mobile menu after clicking on a link
  50. -------------------------------------------------------------------------------*/
  51. $('.navbar-collapse a').click(function(){
  52. $(".navbar-collapse").collapse('hide');
  53. });
  54. /*-------------------------------------------------------------------------------
  55. jQuery easy piechart
  56. -------------------------------------------------------------------------------*/
  57. $(window).scroll( function(){
  58. $('.chart').each( function(i){
  59. var bottom_of_object = $(this).offset().top + $(this).outerHeight();
  60. var bottom_of_window = $(window).scrollTop() + $(window).height();
  61. if( bottom_of_window > bottom_of_object ){
  62. $('.chart').easyPieChart({
  63. scaleColor:false,
  64. trackColor:'#ebedee',
  65. barColor: function(percent) {
  66. var ctx = this.renderer.getCtx();
  67. var canvas = this.renderer.getCanvas();
  68. var gradient = ctx.createLinearGradient(0,0,canvas.width,0);
  69. gradient.addColorStop(0, "#a1c45a");
  70. gradient.addColorStop(1, "#53cde2");
  71. return gradient;
  72. },
  73. lineWidth:5,
  74. lineCap: 'butt',
  75. size:150,
  76. animate:1000
  77. });
  78. }
  79. });
  80. });
  81. /*-------------------------------------------------------------------------------
  82. Back top Top
  83. -------------------------------------------------------------------------------*/
  84. $(window).scroll(function() {
  85. if ($(this).scrollTop() > 200) {
  86. $('.go-top').fadeIn(200);
  87. } else {
  88. $('.go-top').fadeOut(200);
  89. }
  90. });
  91. // Animate the scroll to top
  92. $('.go-top').click(function(event) {
  93. event.preventDefault();
  94. $('html, body').animate({scrollTop: 0}, 300);
  95. });
  96. /*-------------------------------------------------------------------------------
  97. wow js - Animation js
  98. -------------------------------------------------------------------------------*/
  99. new WOW({ mobile: false }).init();
  100. });