script.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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"; // Hide Poppup message
  8. var popupForm = document.getElementById("popup-form");
  9. popupForm.style.display = "none"; // Hide Poppup Form
  10. /* SLIDER */
  11. var clickCounter = 0;
  12. $(".slider_arrows").on("click", function () {
  13. var alex = $("#first-slide polygon.alex"),
  14. alexComment = $("#first-slide polygon.comment-alex"),
  15. alexText = $("#first-slide div.alex-text p"),
  16. anna = $("#first-slide polygon.anna"),
  17. annaComment = $("#first-slide polygon.comment-anna"),
  18. annaText = $("#first-slide div.anna-text p"),
  19. den = $("#first-slide polygon.den"),
  20. denComment = $("#first-slide polygon.comment-den"),
  21. denText = $("#first-slide div.den-text p"),
  22. jane = $("#first-slide polygon.jane"),
  23. janeComment = $("#first-slide polygon.comment-jane"),
  24. janeText = $("#first-slide div.jane-text p");
  25. clickCounter++;
  26. if (clickCounter%2) {
  27. alex.css({"transform": "translate(-184px, 409px)"});
  28. anna.css({"transform": "translate(184px, -409px)"});
  29. den.css({"transform": "translate(183px, 409px)"});
  30. jane.css({"transform": "translate(-183px, -407px)"});
  31. alexComment.css({"transform": "translate(184px, 413px)"});
  32. annaComment.css({"transform": "translate(-183px, -405px)"});
  33. denComment.css({"transform": "translate(-183px, 411px)"});
  34. janeComment.css({"transform": "translate(184px, -405px)"});
  35. alexText.css({"transform": "translate(184px, 413px)"});
  36. annaText.css({"transform": "translate(-183px, -405px)"});
  37. denText.css({"transform": "translate(-183px, 411px)"});
  38. janeText.css({"transform": "translate(184px, -405px)"});
  39. } else {
  40. alex.css({"transform": "translate(0px, 0px)"});
  41. anna.css({"transform": "translate(0px, 0px)"});
  42. den.css({"transform": "translate(0px, 0px)"});
  43. jane.css({"transform": "translate(0px, 0px)"});
  44. alexComment.css({"transform": "translate(0px, 0px)"});
  45. annaComment.css({"transform": "translate(0px, 0px)"});
  46. denComment.css({"transform": "translate(0px, 0px)"});
  47. janeComment.css({"transform": "translate(0px, 0px)"});
  48. alexText.css({"transform": "translate(0px, 0px)"});
  49. annaText.css({"transform": "translate(0px, 0px)"});
  50. denText.css({"transform": "translate(0px, 0px)"});
  51. janeText.css({"transform": "translate(0px, 0px)"});
  52. }
  53. });
  54. /* ----------------------- */
  55. /* BOOK button in the Office seats */
  56. var officeSeatsBtn = $(".office_seats button");
  57. officeSeatsBtn.on("click", function() {
  58. popupForm.style.display = "block";
  59. });
  60. /* ----------------------- */
  61. /* Show Comments */
  62. var author = $("[data-author]");
  63. $("polygon").hover(
  64. function() {
  65. if ($(this).attr("data-author")) {
  66. $(".comment-"+$(this).attr("data-author")).fadeIn(150);
  67. $("."+$(this).attr("data-author")+"-text p").fadeIn(200);
  68. }
  69. },
  70. function() {
  71. $(".comment-"+$(this).attr("data-author")).fadeOut(150);
  72. $("."+$(this).attr("data-author")+"-text p").fadeOut(200);
  73. }
  74. )
  75. /* ----------------------- */
  76. /* Show POP UP after submit the form */
  77. var form = $("form");
  78. form.on("submit", function(event) {
  79. event.preventDefault();
  80. $.ajax({
  81. type: "POST",
  82. url: "mail.php",
  83. data: $(this).serialize()
  84. });
  85. if ($(this).parent().attr("id") == "popup-form") {
  86. $(this).parent().css("display", "none");
  87. popup.style.display = "inline-block";
  88. } else {
  89. popup.style.display = "inline-block";
  90. }
  91. this.reset();
  92. });
  93. /* ----------------------- */
  94. /* POP UP close script */
  95. var popupBtnClose = $("#popupCloseButton");
  96. popupBtnClose.on("click", function(){
  97. popup = document.getElementById("popup");
  98. popup.style.display = "none";
  99. });
  100. /* ----------------------- */
  101. /* Скролл из главного меню */
  102. $("header nav").on("click", "a", function(event) {
  103. event.preventDefault();
  104. var id = $(this).attr("href"),
  105. dest = $(id).offset().top;
  106. $("body,html").animate({
  107. scrollTop: dest
  108. }, 800);
  109. $("header nav div.hamburger").toggleClass("change");
  110. $("header nav ul").toggleClass("active");
  111. });
  112. /* ----------------------- */
  113. /* banner ARROW scroll */
  114. $(".arrow").on("click", function(){
  115. var id = $(this).attr("href");
  116. var dest = $(id).offset().top;
  117. $("body,html").animate({
  118. scrollTop: dest
  119. }, 400);
  120. });
  121. /* ----------------------- */
  122. /* scrollbtn ARROW scroll */
  123. var scrollBtn = $(".scrollbtn");
  124. scrollBtn.css("display", "none");
  125. $(document).scroll( function() {
  126. if ($(window).width() >= '768') {
  127. if ($(document).scrollTop() > 0) {
  128. scrollBtn.fadeIn(400);
  129. } else {
  130. scrollBtn.fadeOut(200);
  131. }
  132. } else return;
  133. });
  134. $(".scrollbtn").on("click", function() {
  135. var id = $(this).attr("href"),
  136. dest = $(id).offset().top;
  137. $("body,html").animate({
  138. scrollTop: dest
  139. }, 400)
  140. });
  141. /* ----------------------- */
  142. /* POP UP close script */
  143. var popupFormBtnClose = $("#popupFormCloseButton");
  144. popupFormBtnClose.on("click", function(){
  145. popupForm.style.display = "none";
  146. });
  147. /* ----------------------- */
  148. /* LOCATION animation */
  149. var loc = document.getElementsByClassName("circle");
  150. [].forEach.call(loc, function(item) {
  151. $(item).hover(
  152. function() {
  153. $("#line", item).slideToggle(200, function() {
  154. $("#location-name", item).slideToggle();
  155. });
  156. },
  157. function() {
  158. $("#location-name", item).slideToggle(200, function() {
  159. $("#line", item).slideToggle();
  160. });
  161. }
  162. );
  163. });
  164. /* ----------------------- */
  165. });