Team:ZJU-China/js/theme

/////////////////////////////////////////// // Display loading image while page loads ///////////////////////////////////////////

// Wait for window load $(window).load(function() {

   // Animate loader off screen
   $(".page-loader").fadeOut("slow");

});


///////////////////////////////////////////////////////////////////// // jQuery for page scrolling feature - requires jQuery Easing plugin /////////////////////////////////////////////////////////////////////

$('.page-scroll').bind('click', function(event) {

   var $anchor = $(this);
   $('html, body').stop().animate({
       scrollTop: $($anchor.attr('href')).offset().top -64
   }, 1500, 'easeInOutExpo');
   event.preventDefault();

});


//////////////////////////////////////////////////////////////////////// // On-Scroll Animated Header: https://github.com/codrops/AnimatedHeader ////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////// // Highlight the top nav as scrolling occurs //////////////////////////////////////////////

$('body').scrollspy({

   target: '.navbar',
   offset: 65

})


//////////////////////////////////////////////////// // OWL Carousel: http://owlgraphic.com/owlcarousel ////////////////////////////////////////////////////

// Intro text carousel $("#owl-intro-text").owlCarousel({

   singleItem : true,
   autoPlay : 6000,
   stopOnHover : true,
   navigation : false,
   navigationText : false,
   pagination : true

})


// Partner carousel $("#owl-partners").owlCarousel({

   items : 4,
   itemsDesktop : [1199,3],
   itemsDesktopSmall : [980,2],
   itemsTablet: [768,2],
   autoPlay : 5000,
   stopOnHover : true,
   pagination : false

})

// Testimonials carousel $("#owl-testimonial").owlCarousel({

   singleItem : true,
   pagination : true,
   autoHeight : true

})


//////////////////////////////////////////////////////////////////// // Stellar (parallax): https://github.com/markdalgleish/stellar.js ////////////////////////////////////////////////////////////////////

$.stellar({

   // Set scrolling to be in either one or both directions
   horizontalScrolling: false,
   verticalScrolling: true,

});


/////////////////////////////////////////////////////////// // WOW animation scroll: https://github.com/matthieua/WOW ///////////////////////////////////////////////////////////

new WOW().init();


//////////////////////////////////////////////////////////////////////////////////////////// // Counter-Up (requires jQuery waypoints.js plugin): https://github.com/bfintal/Counter-Up ////////////////////////////////////////////////////////////////////////////////////////////

$('.counter').counterUp({

   delay: 10,
   time: 2000

});


//////////////////////////////////////////////////////////////////////////////////////////// // Isotop Package //////////////////////////////////////////////////////////////////////////////////////////// $(window).load(function() { $('.portfolio_menu ul li').click(function(){ $('.portfolio_menu ul li').removeClass('active_prot_menu'); $(this).addClass('active_prot_menu'); });

var $container = $('#portfolio'); $container.isotope({

 itemSelector: '.col-sm-4',
 layoutMode: 'fitRows'

}); $('#filters').on( 'click', 'a', function() {

 var filterValue = $(this).attr('data-filter');
 $container.isotope({ filter: filterValue });
 return false;

}); });


///////////////////////// // Scroll to top button /////////////////////////

// Check to see if the window is top if not then display button $(window).scroll(function(){

   if ($(this).scrollTop() > 500) {
       $('.scrolltotop').fadeIn();
   } else {
       $('.scrolltotop').fadeOut();
   }

});

// Click event to scroll to top $('.scrolltotop').click(function(){

   $('html, body').animate({scrollTop : 0}, 1500, 'easeInOutExpo');
   return false;

});


//////////////////////////////////////////////////////////////////// // Close mobile menu when click menu link (Bootstrap default menu) ////////////////////////////////////////////////////////////////////

$(document).on('click','.navbar-collapse.in',function(e) {

   if( $(e.target).is('a') && $(e.target).attr('class') != 'dropdown-toggle' ) {
       $(this).collapse('hide');
   }

});