Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. jQuery(function ($) {
  2. "use strict";
  3. /* ========================================================================= */
  4. /* Page Preloader
  5. /* ========================================================================= */
  6. // Preloader js
  7. $(window).on('load', function () {
  8. $('#preloader').fadeOut(700);
  9. });
  10. /* ========================================================================= */
  11. /* Post image slider
  12. /* ========================================================================= */
  13. $("#post-thumb, #gallery-post").slick({
  14. infinite: true,
  15. arrows: false,
  16. autoplay: true,
  17. autoplaySpeed: 4000
  18. });
  19. $("#features").slick({
  20. infinite: true,
  21. arrows: false,
  22. autoplay: true,
  23. autoplaySpeed: 4000
  24. });
  25. /* ========================================================================= */
  26. /* Menu item highlighting
  27. /* ========================================================================= */
  28. $("#navigation").sticky({
  29. topSpacing: 0
  30. });
  31. /* ========================================================================= */
  32. /* Magnific popup
  33. /* ========================================================================= */
  34. $('.image-popup').magnificPopup({
  35. type: 'image',
  36. removalDelay: 160, //delay removal by X to allow out-animation
  37. callbacks: {
  38. beforeOpen: function () {
  39. // just a hack that adds mfp-anim class to markup
  40. this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
  41. this.st.mainClass = this.st.el.attr('data-effect');
  42. }
  43. },
  44. closeOnContentClick: true,
  45. midClick: true,
  46. fixedContentPos: false,
  47. fixedBgPos: true
  48. });
  49. /* ========================================================================= */
  50. /* Portfolio Filtering Hook
  51. /* ========================================================================= */
  52. if ($('.portfolio-items-wrapper').length)
  53. mixitup('.portfolio-items-wrapper');
  54. /* ========================================================================= */
  55. /* Testimonial Carousel
  56. /* ========================================================================= */
  57. //Init the carousel
  58. $("#testimonials").slick({
  59. infinite: true,
  60. arrows: false,
  61. autoplay: true,
  62. autoplaySpeed: 4000
  63. });
  64. /* ========================================================================= */
  65. /* Contact Form Validating
  66. /* ========================================================================= */
  67. $('#contact-submit').click(function (e) {
  68. //stop the form from being submitted
  69. e.preventDefault();
  70. /* declare the variables, var error is the variable that we use on the end
  71. to determine if there was an error or not */
  72. var error = false;
  73. var name = $('#name').val();
  74. var email = $('#email').val();
  75. var subject = $('#subject').val();
  76. var message = $('#message').val();
  77. /* in the next section we do the checking by using VARIABLE.length
  78. where VARIABLE is the variable we are checking (like name, email),
  79. length is a JavaScript function to get the number of characters.
  80. And as you can see if the num of characters is 0 we set the error
  81. variable to true and show the name_error div with the fadeIn effect.
  82. if it's not 0 then we fadeOut the div( that's if the div is shown and
  83. the error is fixed it fadesOut.
  84. The only difference from these checks is the email checking, we have
  85. email.indexOf('@') which checks if there is @ in the email input field.
  86. This JavaScript function will return -1 if no occurrence have been found.*/
  87. if (name.length == 0) {
  88. var error = true;
  89. $('#name').css("border-color", "#D8000C");
  90. } else {
  91. $('#name').css("border-color", "#666");
  92. }
  93. if (email.length == 0 || email.indexOf('@') == '-1') {
  94. var error = true;
  95. $('#email').css("border-color", "#D8000C");
  96. } else {
  97. $('#email').css("border-color", "#666");
  98. }
  99. if (subject.length == 0) {
  100. var error = true;
  101. $('#subject').css("border-color", "#D8000C");
  102. } else {
  103. $('#subject').css("border-color", "#666");
  104. }
  105. if (message.length == 0) {
  106. var error = true;
  107. $('#message').css("border-color", "#D8000C");
  108. } else {
  109. $('#message').css("border-color", "#666");
  110. }
  111. //now when the validation is done we check if the error variable is false (no errors)
  112. if (error == false) {
  113. //disable the submit button to avoid spamming
  114. //and change the button text to Sending...
  115. $('#contact-submit').attr({
  116. 'disabled': 'false',
  117. 'value': 'Sending...'
  118. });
  119. /* using the jquery's post(ajax) function and a lifesaver
  120. function serialize() which gets all the data from the form
  121. we submit it to send_email.php */
  122. $.post("sendmail.php", $("#contact-form").serialize(), function (result) {
  123. //and after the ajax request ends we check the text returned
  124. if (result == 'sent') {
  125. //if the mail is sent remove the submit paragraph
  126. $('#cf-submit').remove();
  127. //and show the mail success div with fadeIn
  128. $('#mail-success').fadeIn(500);
  129. } else {
  130. //show the mail failed div
  131. $('#mail-fail').fadeIn(500);
  132. //re enable the submit button by removing attribute disabled and change the text back to Send The Message
  133. $('#contact-submit').removeAttr('disabled').attr('value', 'Send The Message');
  134. }
  135. });
  136. }
  137. });
  138. });
  139. // End Jquery Function
  140. /* ========================================================================= */
  141. /* Animated section
  142. /* ========================================================================= */
  143. var wow = new WOW({
  144. offset: 100, // distance to the element when triggering the animation (default is 0)
  145. mobile: false // trigger animations on mobile devices (default is true)
  146. });
  147. wow.init();
  148. /* ========================================================================= */
  149. /* Smooth Scroll
  150. /* ========================================================================= */
  151. var scroll = new SmoothScroll('a[href*="#"]');
  152. /* ========================================================================= */
  153. /* Google Map Customization
  154. /* ========================================================================= */
  155. function initialize() {
  156. var latitude = $('#map-canvas').attr('data-latitude');
  157. var longitude = $('#map-canvas').attr('data-longitude');
  158. var myLatLng = new google.maps.LatLng(latitude, longitude);
  159. var roadAtlasStyles = [{
  160. "featureType": "landscape",
  161. "elementType": "geometry.fill",
  162. "stylers": [{
  163. "color": "#2F3238"
  164. }]
  165. }, {
  166. "elementType": "labels.text.fill",
  167. "stylers": [{
  168. "color": "#FFFFFF"
  169. }]
  170. }, {
  171. "elementType": "labels.text.stroke",
  172. "stylers": [{
  173. "visibility": "off"
  174. }]
  175. }, {
  176. "featureType": "road",
  177. "elementType": "geometry.fill",
  178. "stylers": [{
  179. "color": "#50525f"
  180. }]
  181. }, {
  182. "featureType": "road",
  183. "elementType": "geometry.stroke",
  184. "stylers": [{
  185. "visibility": "on"
  186. }, {
  187. "color": "#808080"
  188. }]
  189. }, {
  190. "featureType": "poi",
  191. "elementType": "labels",
  192. "stylers": [{
  193. "visibility": "off"
  194. }]
  195. }, {
  196. "featureType": "transit",
  197. "elementType": "labels.icon",
  198. "stylers": [{
  199. "visibility": "off"
  200. }]
  201. }, {
  202. "featureType": "poi",
  203. "elementType": "geometry",
  204. "stylers": [{
  205. "color": "#808080"
  206. }]
  207. }, {
  208. "featureType": "water",
  209. "elementType": "geometry.fill",
  210. "stylers": [{
  211. "color": "#3071a7"
  212. }, {
  213. "saturation": -65
  214. }]
  215. }, {
  216. "featureType": "road",
  217. "elementType": "labels.icon",
  218. "stylers": [{
  219. "visibility": "off"
  220. }]
  221. }, {
  222. "featureType": "landscape",
  223. "elementType": "geometry.stroke",
  224. "stylers": [{
  225. "color": "#bbbbbb"
  226. }]
  227. }];
  228. var mapOptions = {
  229. zoom: 14,
  230. center: myLatLng,
  231. disableDefaultUI: true,
  232. scrollwheel: false,
  233. navigationControl: false,
  234. mapTypeControl: false,
  235. scaleControl: false,
  236. draggable: false,
  237. mapTypeControlOptions: {
  238. mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'roadatlas']
  239. }
  240. };
  241. var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
  242. var marker = new google.maps.Marker({
  243. position: myLatLng,
  244. map: map,
  245. title: '',
  246. });
  247. google.maps.event.addListener(marker, 'click', function () {
  248. infowindow.open(map, marker);
  249. });
  250. var styledMapOptions = {
  251. name: 'US Road Atlas'
  252. };
  253. var usRoadMapType = new google.maps.StyledMapType(
  254. roadAtlasStyles, styledMapOptions);
  255. map.mapTypes.set('roadatlas', usRoadMapType);
  256. map.setMapTypeId('roadatlas');
  257. }
  258. // Check init google maps only if "google" has been defined.
  259. if("google" in window)
  260. google.maps.event.addDomListener(window, "load", initialize);