script.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. function hamburgerClickHandler() {
  2. $("header nav div.hamburger").toggleClass("change");
  3. $("header nav ul").toggleClass("active");
  4. }
  5. $(document).ready(function() {
  6. var popup = document.getElementById("popup");
  7. // popup.style.display = "none";
  8. var firstSlide = document.getElementById("first-slide");
  9. var secondSlide = document.getElementById("second-slide");
  10. firstSlide.style.display = "block";
  11. firstSlide.setAttribute("data-class", "active");
  12. secondSlide.style.display = "none";
  13. firstSlide.setAttribute("data-class", "not-active");
  14. $("#sliderBtn").on("click", function() {
  15. $("[data-class=active]").fadeOut();
  16. });
  17. /* Show POP UP after submit the form */
  18. var form = $("form");
  19. form.on("submit", function(event) {
  20. event.preventDefault();
  21. // $.ajax({
  22. // type: "POST",
  23. // url: "mail.php",
  24. // data: $(this).serialize()
  25. // });
  26. var popup = document.getElementById("popup");
  27. popup.style.display = "inline-block";
  28. this.reset();
  29. });
  30. /* ----------------------- */
  31. /* POP UP close script */
  32. var popupBtnClose = $("#popupCloseButton");
  33. popupBtnClose.on("click", function(){
  34. var popup = document.getElementById("popup");
  35. popup.style.display = "none";
  36. });
  37. /* ----------------------- */
  38. /* Скролл из главного меню */
  39. $("header nav").on("click", "a", function(event) {
  40. event.preventDefault();
  41. var id = $(this).attr("href"),
  42. dest = $(id).offset().top;
  43. $("body,html").animate({
  44. scrollTop: dest
  45. }, 800);
  46. $("header nav div.hamburger").toggleClass("change");
  47. $("header nav ul").toggleClass("active");
  48. });
  49. /* ----------------------- */
  50. /* banner ARROW scroll */
  51. $(".arrow").on("click", function(){
  52. var id = $(this).attr("href");
  53. console.log(id);
  54. var dest = $(id).offset().top;
  55. $("body,html").animate({
  56. scrollTop: dest
  57. }, 400);
  58. });
  59. /* ----------------------- */
  60. /* scrollbtn ARROW scroll */
  61. $(".scrollbtn").on("click", function() {
  62. var id = $(this).attr("href");
  63. console.log(id);
  64. var dest = $(id).offset().top;
  65. $("body,html").animate({
  66. scrollTop: dest
  67. }, 400)
  68. });
  69. });