scripts.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. function scroll_to(clicked_link, nav_height) {
  2. var element_class = clicked_link.attr('href').replace('#', '.');
  3. var scroll_to = 0;
  4. if(element_class != '.top-content') {
  5. element_class += '-container';
  6. scroll_to = $(element_class).offset().top - nav_height;
  7. }
  8. if($(window).scrollTop() != scroll_to) {
  9. $('html, body').stop().animate({scrollTop: scroll_to}, 1000);
  10. }
  11. }
  12. jQuery(document).ready(function() {
  13. /*
  14. Navigation
  15. */
  16. $('a.scroll-link').on('click', function(e) {
  17. e.preventDefault();
  18. scroll_to($(this), 0);
  19. });
  20. /*
  21. Background slideshow
  22. */
  23. // $('.top-content').backstretch("assets/img/backgrounds/1.jpg");
  24. // $('.how-it-works-container').backstretch("assets/img/backgrounds/1.jpg");
  25. // $('.call-to-action-container').backstretch("assets/img/backgrounds/1.jpg");
  26. $('#top-navbar-1').on('shown.bs.collapse', function(){
  27. $('.top-content').backstretch("resize");
  28. });
  29. $('#top-navbar-1').on('hidden.bs.collapse', function(){
  30. $('.top-content').backstretch("resize");
  31. });
  32. /*
  33. Wow
  34. */
  35. new WOW().init();
  36. /*
  37. Modals
  38. */
  39. $('.launch-modal').on('click', function(e){
  40. e.preventDefault();
  41. $( '#' + $(this).data('modal-id') ).modal();
  42. });
  43. });
  44. jQuery(window).load(function() {
  45. /*
  46. Loader
  47. */
  48. $(".loader-img").fadeOut();
  49. $(".loader").delay(1000).fadeOut("slow");
  50. /*
  51. Hidden images
  52. */
  53. $(".modal-body img, .testimonial-image img, #slider-1 img").attr("style", "width: auto !important; height: auto !important;");
  54. });