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

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