BCB Bank static website
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

164 linhas
4.0 KiB

  1. var desktop_navigation_menu_links = document.querySelectorAll('#desktop-navigation-menu ul li');
  2. for (var i = 0; i < desktop_navigation_menu_links.length; i++) {
  3. desktop_navigation_menu_links[i].addEventListener('click', changeActiveClass);
  4. }
  5. function changeActiveClass(e) {
  6. for (var i = 0; i < desktop_navigation_menu_links.length; i++) {
  7. desktop_navigation_menu_links[i].classList.remove('active');
  8. }
  9. e.currentTarget.classList.add('active');
  10. }
  11. var page_header = document.getElementById('page-header');
  12. var about_description_animate = document.querySelector('#about .description');
  13. var about_image_animate = document.querySelector('#about figure');
  14. window.addEventListener('scroll', page_scroll);
  15. document.addEventListener('DOMContentLoaded', page_loaded);
  16. function page_scroll() {
  17. 'use strict';
  18. var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
  19. if (-120 + winScroll >= about_description_animate.offsetTop) {
  20. about_description_animate.classList.add('show');
  21. about_image_animate.classList.add('show');
  22. }
  23. }
  24. var home_image = document.querySelector('#home figure');
  25. var home_description = document.querySelector('#home .description');
  26. var temp_contact_info = document.querySelectorAll('.temp-contact-info ul li');
  27. function page_loaded() {
  28. home_image.classList.remove('hide');
  29. home_description.classList.remove('hide');
  30. if ($(window).width() < 960) {
  31. $(document).on('click', 'a[href^="#"]', function (event) {
  32. event.preventDefault();
  33. $('html, body').animate({
  34. scrollTop: $($.attr(this, 'href')).offset().top - 780
  35. }, 500);
  36. });
  37. for (var i = 0; i < temp_contact_info.length; i++) {
  38. temp_contact_info[i].addEventListener('click', toggle_contact_info);
  39. }
  40. }
  41. }
  42. function toggle_contact_info(e) {
  43. for (var i = 0; i < temp_contact_info.length; i++) {
  44. temp_contact_info[i].classList.remove('active');
  45. }
  46. e.currentTarget.classList.add('active');
  47. }
  48. var mobile_nav_lists = document.querySelectorAll('#mobile-nav-menu ul li');
  49. for (var i = 0; i < mobile_nav_lists.length; i++) {
  50. mobile_nav_lists[i].addEventListener('click', hide_mobile_nav);
  51. }
  52. function hide_mobile_nav() {
  53. mobile_menu.classList.remove('show');
  54. hamburger_menu.classList.remove('active');
  55. document.body.classList.remove('non-scrollable');
  56. }
  57. // Native method of doing smooth scrolling
  58. document.querySelectorAll('a[href^="#"]').forEach(function(anchor) {
  59. anchor.addEventListener('click', function (e) {
  60. e.preventDefault();
  61. document.querySelector(this.getAttribute('href')).scrollIntoView({
  62. behavior: 'smooth'
  63. });
  64. });
  65. });
  66. // Support for old Browsers.
  67. $(document).on('click', 'a[href^="#"]', function (event) {
  68. event.preventDefault();
  69. $('html, body').animate({
  70. scrollTop: $($.attr(this, 'href')).offset().top - 100
  71. }, 500);
  72. });
  73. var owl = $('.owl-service');
  74. owl.owlCarousel({
  75. loop: true,
  76. margin: 0,
  77. autoplay: true,
  78. autoplayTimeout: 3000,
  79. autoplayHoverPause: true,
  80. responsiveClass: true,
  81. responsive: {
  82. 0: {
  83. items: 1,
  84. stagePadding: 100,
  85. },
  86. 600: {
  87. items: 1,
  88. stagePadding: 100,
  89. },
  90. 1000: {
  91. items: 3
  92. }
  93. }
  94. });
  95. var service_carousel_Btn = $('.owl-service');
  96. owl.owlCarousel();
  97. $('#service-carousel-left-btn').click(function () {
  98. "use strict";
  99. service_carousel_Btn.trigger('next.owl.carousel', [300]);
  100. });
  101. $('#service-carousel-right-btn').click(function () {
  102. "use strict";
  103. service_carousel_Btn.trigger('prev.owl.carousel', [300]);
  104. });
  105. var owl = $('.owl-branches');
  106. owl.owlCarousel({
  107. loop: true,
  108. margin: 0,
  109. autoplay: false,
  110. autoplayTimeout: 3000,
  111. autoplayHoverPause: true,
  112. responsiveClass: true,
  113. responsive: {
  114. 0: {
  115. items: 1
  116. },
  117. 600: {
  118. items: 1
  119. },
  120. 1000: {
  121. items: 3,
  122. }
  123. }
  124. });
  125. var branches_carousel_Btn = $('.owl-branches');
  126. owl.owlCarousel();
  127. $('#branches-carousel-left-btn').click(function () {
  128. "use strict";
  129. branches_carousel_Btn.trigger('next.owl.carousel', [300]);
  130. });
  131. $('#branches-carousel-right-btn').click(function () {
  132. "use strict";
  133. branches_carousel_Btn.trigger('prev.owl.carousel', [300]);
  134. });