Advertisement
Guest User

Script JS

a guest
Nov 1st, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Cozy;
  2.  
  3. (function ($) { "use strict";
  4.  
  5.     jQuery(document).ready(function () {
  6.  
  7.         Cozy = {
  8.  
  9.             initialized: false,
  10.             mobMenuFlag: false,
  11.             mobileMenuTitle: mobileMenuTitle,
  12.             twitter_username: twitter_username,
  13.             agency_initialZoom: agency_initialZoom,
  14.             agency_selectedZoom: agency_selectedZoom,
  15.             agency_mapInitialLatitude: agency_mapInitialLatitude,
  16.             agency_mapInitialLongitude: agency_mapInitialLongitude,
  17.             agency_viewMore: agency_viewMore,
  18.             properties_cluster_marker: properties_cluster_marker,
  19.             properties_cluster_textcolor: properties_cluster_textcolor,
  20.             properties_initialZoom: properties_initialZoom,
  21.             properties_selectedZoom: properties_selectedZoom,
  22.             properties_mapInitialLatitude: properties_mapInitialLatitude,
  23.             properties_mapInitialLongitude: properties_mapInitialLongitude,
  24.             properties_viewMore: properties_viewMore,
  25.             use_default_map_style: use_default_map_style,
  26.             sendingMail: false,
  27.  
  28.             init: function () {
  29.  
  30.                 var $tis = this;
  31.  
  32.                 if ($tis.initialized) {
  33.                     return;
  34.                 }
  35.  
  36.                 $tis.initialized = true;
  37.                 $tis.build();
  38.                 $tis.events();
  39.             },
  40.  
  41.             build: function () {
  42.  
  43.                 var $tis = this;
  44.  
  45.                 /**
  46.                  * Dinamically create the menu for mobile devices
  47.                  */
  48.                 $tis.createMobileMenu();
  49.  
  50.                 /**
  51.                  * Get latest tweets
  52.                  */
  53.                 $tis.getLatestTweets();
  54.  
  55.                 /**
  56.                  * Create Owl Sliders
  57.                  */
  58.                 $tis.createOwlSliders();
  59.  
  60.                 /**
  61.                  * Create Revolution Slider
  62.                  */
  63.                 $tis.createRevSlider();
  64.  
  65.                 /**
  66.                  * Create custom select boxes
  67.                  */
  68.                 $tis.createSelectBoxes();
  69.  
  70.                 /**
  71.                  * Create custom check boxes
  72.                  */
  73.                 $tis.createCheckBoxes();
  74.  
  75.                 /**
  76.                  * Build properties grid
  77.                  */
  78.                 $tis.propertiesGrid();
  79.  
  80.                 /**
  81.                  * Create PrettyPhoto links
  82.                  */
  83.                 if (jQuery("a[data-gal^='prettyPhoto']").length) {
  84.                     jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({theme: 'cozy', hook: 'data-gal', social_tools: false});
  85.                 }
  86.  
  87.                 /**
  88.                  * Create Tooltip objects
  89.                  */
  90.                 jQuery('[data-toggle="tooltip"]').tooltip();
  91.  
  92.                 /**
  93.                  * Initiate Parallax
  94.                  */
  95.                 $tis.parallaxItems();
  96.             },
  97.  
  98.             events: function () {
  99.  
  100.                 var $tis = this;
  101.  
  102.                 /**
  103.                  * Functions called on window resize
  104.                  */
  105.                 $tis.windowResize();
  106.  
  107.                 /**
  108.                  * Make the navbar stick to the top on scroll
  109.                  */
  110.                 $tis.stickyNav();
  111.  
  112.                 /**
  113.                  * If #content has class colored, make the sidebar with a minimun height equal to #main height
  114.                  */
  115.                 $tis.resizeSidebar();
  116.  
  117.                 /**
  118.                  * Buttons click event
  119.                  */
  120.                 $tis.buttonsClick();
  121.  
  122.                 /**
  123.                  * Initialize countUp plugin
  124.                  */
  125.                 $tis.initCountUp();
  126.  
  127.                 /**
  128.                  * Contact form submit
  129.                  */
  130.                 $tis.contactForm();
  131.  
  132.                 /**
  133.                  * View Mode Switcher
  134.                  */
  135.                 $tis.viewModeSwitcher();
  136.  
  137.                 /**
  138.                  * Animate elements on scrolling
  139.                  */
  140.                 $tis.animateElems();
  141.             },
  142.  
  143.             createMobileMenu: function (w) {
  144.  
  145.                 var $tis = this,
  146.                     $wrapper = jQuery('#wrapper'),
  147.                     $navMobile,
  148.                     etype = $.browser.mobile ? 'touchstart' : 'click';
  149.  
  150.                 if (w !== null) {
  151.                     w = jQuery(window).innerWidth();
  152.                 }
  153.  
  154.                 if (w <= 975 && !$tis.mobMenuFlag) {
  155.  
  156.                     jQuery('body').prepend('<nav class="nav-mobile"><i class="fa fa-times"></i><h2><i class="fa fa-bars"></i>' + $tis.mobileMenuTitle + '</h2><ul></ul></nav>');
  157.  
  158.                     jQuery('.nav-mobile > ul').html(jQuery('.nav').html());
  159.  
  160.                     jQuery('.nav-mobile b').remove();
  161.  
  162.                     jQuery('.nav-mobile ul.dropdown-menu').removeClass().addClass("dropdown-mobile");
  163.  
  164.                     //jQuery('.nav-mobile').css({'min-height': (jQuery('#wrapper').height() + 270) + 'px' });
  165.  
  166.                     $navMobile = jQuery(".nav-mobile");
  167.  
  168.                     jQuery("#nav-mobile-btn").bind(etype, function (e) {
  169.                         e.stopPropagation();
  170.                         e.preventDefault();
  171.  
  172.                         setTimeout(function () {
  173.                             $wrapper.addClass('open');
  174.                             $navMobile.addClass('open');
  175.                             $navMobile.getNiceScroll().show();
  176.                         }, 25);
  177.  
  178.                         $.waypoints('disable');
  179.  
  180.                         jQuery(document).bind(etype, function (e) {
  181.                             if (!jQuery(e.target).hasClass('nav-mobile') && !jQuery(e.target).parents('.nav-mobile').length) {
  182.                                 $wrapper.removeClass('open');
  183.                                 $navMobile.removeClass('open');
  184.                                 jQuery(document).unbind(etype);
  185.                                 $.waypoints('enable');
  186.                             }
  187.                         });
  188.  
  189.                         jQuery('>i', $navMobile).bind(etype, function () {
  190.                             $navMobile.getNiceScroll().hide();
  191.                             $wrapper.removeClass('open');
  192.                             $navMobile.removeClass('open');
  193.                             jQuery(document).unbind(etype);
  194.                             $.waypoints('enable');
  195.                         });
  196.                     });
  197.  
  198.                     $navMobile.niceScroll({
  199.                         autohidemode: true,
  200.                         cursorcolor: "#c2c2c2",
  201.                         cursoropacitymax: "0.7",
  202.                         cursorwidth: 10,
  203.                         cursorborder: "0px solid #000",
  204.                         horizrailenabled: false,
  205.                         zindex: "1"
  206.                     });
  207.  
  208.                     $navMobile.getNiceScroll().hide();
  209.  
  210.                     $tis.mobMenuFlag = true;
  211.                 }
  212.             },
  213.  
  214.             getLatestTweets: function () {
  215.  
  216.                 var $tis = this,
  217.                     twitterBox = document.createElement('div'),
  218.                     len = jQuery(".twitter .item").length,
  219.                     index = 0;
  220.  
  221.                 if (len === 0) {
  222.                     return false;
  223.                 }
  224.  
  225.                 twitterBox.setAttribute('id', 'twitter-box');
  226.  
  227.                 jQuery('body').append(twitterBox);
  228.  
  229.                 jQuery("#twitter-box").css({display: 'none'});
  230.  
  231.                 try {
  232.                     jQuery("#twitter-box").tweet({
  233.                         username: $tis.twitter_username,
  234.                         modpath: 'twitter/',
  235.                         count: len,
  236.                         loading_text: 'Loading tweets...',
  237.                         template: '<header><h3>{name}</h3><a href="http://twitter.com/{screen_name}" target="_blank">@{screen_name}</a>&nbsp;.&nbsp;<a href="http://twitter.com/{screen_name}/statuses/{tweet_id}/" target="_blank" class="time">{tweet_relative_time}</a></header><div class="text">{text}</div>'
  238.                     });
  239.                 } catch (err) {
  240.                     console.log("Your twitter account is misconfigured.");
  241.                 }
  242.  
  243.                 jQuery("#twitter-box li").each(function () {
  244.                     if (index < len) {
  245.                         jQuery(".twitter .item").eq(index).html(jQuery(this).html());
  246.                         index += 1;
  247.                     } else {
  248.                         return false;
  249.                     }
  250.                 });
  251.  
  252.                 jQuery("#twitter-box").remove();
  253.             },
  254.  
  255.             createOwlSliders: function () {
  256.  
  257.                 if (jQuery("#new-properties-slider").length) {
  258.                     jQuery("#new-properties-slider").owlCarousel({
  259.                         itemsCustom : [
  260.                             [0, 1],
  261.                             [590, 2],
  262.                             [751, 2],
  263.                             [975, 3],
  264.                             [1183, 4],
  265.                             [1440, 4],
  266.                             [1728, 4]
  267.                         ]
  268.                     });
  269.                 }
  270.  
  271.                 if (jQuery("#property-gallery").length) {
  272.                     jQuery("#property-gallery").owlCarousel({
  273.                         navigation: true,
  274.                         navigationText: false,
  275.                         pagination: false,
  276.                         itemsCustom : [
  277.                             [0, 1],
  278.                             [392, 2],
  279.                             [596, 3],
  280.                             [751, 2],
  281.                             [975, 3],
  282.                             [1183, 3],
  283.                             [1440, 3],
  284.                             [1728, 3]
  285.                         ]
  286.                     });
  287.                 }
  288.  
  289.                 if (jQuery("#testimonials-slider").length) {
  290.                     jQuery("#testimonials-slider").owlCarousel({
  291.                         singleItem : true,
  292.                         autoHeight : true,
  293.                         mouseDrag: false,
  294.                         transitionStyle : "fade"
  295.                     });
  296.                 }
  297.  
  298.                 if (jQuery("#featured-properties-slider").length) {
  299.                     jQuery(".fullwidthsingle .item").each(function () {
  300.                         var $item = jQuery(this);
  301.                         jQuery('.image', $item).css({'background-image': 'url(' + jQuery('.image img', $item).attr('src') + ')'});
  302.                         jQuery('.image img', $item).remove();
  303.                     });
  304.  
  305.                     jQuery("#featured-properties-slider").owlCarousel({
  306.                         singleItem : true,
  307.                         autoHeight : true,
  308.                         mouseDrag: false,
  309.                         transitionStyle : "fade"
  310.                     });
  311.                 }
  312.  
  313.                 if (jQuery("#latest-properties-slider").length) {
  314.                     jQuery(".fullwidthsingle2 .item").each(function () {
  315.                         var $item = jQuery(this);
  316.                         jQuery('.image', $item).css({'background-image': 'url(' + jQuery('.image img', $item).attr('src') + ')'});
  317.                         jQuery('.image img', $item).remove();
  318.                     });
  319.  
  320.                     jQuery("#latest-properties-slider").owlCarousel({
  321.                         navigation: true,
  322.                         navigationText: false,
  323.                         pagination: false,
  324.                         singleItem : true,
  325.                         autoHeight : true
  326.                     });
  327.                 }
  328.  
  329.                 if (jQuery("#latest-news-slider").length) {
  330.                     jQuery(".latest-news-slider .item").each(function () {
  331.                         var $item = jQuery(this);
  332.                         jQuery('.image', $item).css({'background-image': 'url(' + jQuery('.image img', $item).attr('src') + ')'});
  333.                         jQuery('.image img', $item).remove();
  334.                     });
  335.  
  336.                     jQuery("#latest-news-slider").owlCarousel({
  337.                         singleItem : true,
  338.                         autoHeight : true,
  339.                         mouseDrag: false,
  340.                         transitionStyle : "fade"
  341.                     });
  342.                 }
  343.  
  344.                 if (jQuery("#twitter-slider").length) {
  345.                     jQuery("#twitter-slider").owlCarousel({
  346.                         singleItem : true,
  347.                         autoHeight : true,
  348.                         mouseDrag: false,
  349.                         transitionStyle : "fade"
  350.                     });
  351.                 }
  352.  
  353.                 if (jQuery("#property-detail-large").length && jQuery("#property-detail-thumbs").length) {
  354.                     var sync1 = jQuery("#property-detail-large"),
  355.                         sync2 = jQuery("#property-detail-thumbs"),
  356.  
  357.                         center  = function (number) {
  358.                             var sync2visible = sync2.data("owlCarousel").owl.visibleItems,
  359.                                 num = number,
  360.                                 found = false,
  361.                                 i;
  362.  
  363.                             for (i = 0; i < sync2visible.lenght - 1; i += 1) {
  364.                                 if (num === sync2visible[i]) {
  365.                                     found = true;
  366.                                 }
  367.                             }
  368.  
  369.                             if (found === false) {
  370.                                 if (num > sync2visible[sync2visible.length - 1]) {
  371.                                     sync2.trigger("owl.goTo", num - sync2visible.length + 2);
  372.                                 } else {
  373.                                     if (num - 1 === -1) {
  374.                                         num = 0;
  375.                                     }
  376.                                     sync2.trigger("owl.goTo", num);
  377.                                 }
  378.                             } else if (num === sync2visible[sync2visible.length - 1]) {
  379.                                 sync2.trigger("owl.goTo", sync2visible[1]);
  380.                             } else if (num === sync2visible[0]) {
  381.                                 sync2.trigger("owl.goTo", num - 1);
  382.                             }
  383.                         },
  384.  
  385.                         syncPosition = function () {
  386.                             /*jshint validthis: true */
  387.  
  388.                             var current = this.currentItem;
  389.  
  390.                             jQuery("#property-detail-thumbs")
  391.                                 .find(".owl-item")
  392.                                 .removeClass("synced")
  393.                                 .eq(current)
  394.                                 .addClass("synced");
  395.  
  396.                             if (jQuery("#sync2").data("owlCarousel") !== undefined) {
  397.                                 center(current);
  398.                             }
  399.                         };
  400.  
  401.                     jQuery(".item", sync2).each(function () {
  402.                         var $item = jQuery(this);
  403.                         $item.css({'background-image': 'url(' + jQuery('img', $item).attr('src') + ')'});
  404.                         jQuery('img', $item).remove();
  405.                     });
  406.  
  407.                     sync1.owlCarousel({
  408.                         singleItem : true,
  409.                         slideSpeed : 1000,
  410.                         navigation: false,
  411.                         pagination: false,
  412.                         autoHeight : true,
  413.                         afterAction : syncPosition,
  414.                         responsiveRefreshRate : 200
  415.                     });
  416.  
  417.                     sync2.owlCarousel({
  418.                         itemsCustom : [
  419.                             [0, 2],
  420.                             [300, 3],
  421.                             [629, 4],
  422.                             [751, 3],
  423.                             [975, 4],
  424.                             [1183, 5]
  425.                         ],
  426.                         pagination: true,
  427.                         responsiveRefreshRate : 100,
  428.                         afterInit : function (el) {
  429.                             el.find(".owl-item").eq(0).addClass("synced");
  430.                         }
  431.                     });
  432.  
  433.                     jQuery("#property-detail-thumbs").on("click", ".owl-item", function (e) {
  434.                         e.preventDefault();
  435.                         var number = jQuery(this).data("owlItem");
  436.                         sync1.trigger("owl.goTo", number);
  437.                     });
  438.                 }
  439.             },
  440.  
  441.             createRevSlider: function () {
  442.  
  443.                 if (jQuery('.revslider').length) {
  444.                     jQuery('.revslider').revolution({
  445.                         delay: 9000,
  446.                         startwidth: 1170,
  447.                         startheight: 500,
  448.                         hideThumbs: 10,
  449.                         navigationType: "none",
  450.                         fullWidth: "on"
  451.                     });
  452.                 }
  453.             },
  454.  
  455.             createSelectBoxes: function () {
  456.  
  457.                 if (jQuery('select').length) {
  458.                     jQuery("select").chosen({
  459.                         allow_single_deselect: true,
  460.                         disable_search_threshold: 12
  461.                     });
  462.                 }
  463.             },
  464.  
  465.             createCheckBoxes: function () {
  466.  
  467.                 if (jQuery('input[type="checkbox"]').length) {
  468.                     jQuery('input[type="checkbox"]').checkbox({
  469.                         checkedClass: 'fa fa-check-square-o',
  470.                         uncheckedClass: 'fa fa-square-o'
  471.                     });
  472.                 }
  473.             },
  474.  
  475.             propertiesGrid: function () {
  476.  
  477.                 if (jQuery('#freewall').length) {
  478.                     jQuery("#freewall .item").each(function () {
  479.                         var $item = jQuery(this);
  480.                         $item.width(Math.floor(200 +  200 * Math.random()));
  481.                         $item.css({'background-image': 'url(' + jQuery('>img', $item).attr('src') + ')'});
  482.                         jQuery('>img', $item).remove();
  483.                     });
  484.  
  485.                     var wall = new Freewall("#freewall");
  486.                     wall.reset({
  487.                         selector: '.item',
  488.                         animate: false,
  489.                         cellW: 20,
  490.                         cellH: 240,
  491.                         gutterX: 1,
  492.                         gutterY: 1,
  493.                         onResize: function () {
  494.                             wall.fitWidth();
  495.                         }
  496.                     });
  497.                     wall.fitWidth();
  498.                 }
  499.             },
  500.  
  501.             parallaxItems: function () {
  502.  
  503.                 if (!$.browser.mobile) {
  504.                     $.stellar();
  505.                 } else {
  506.                     jQuery('.parallax, #home-search-section').css({'background-position': '50% 50%', 'background-size': 'cover', 'background-attachment': 'scroll'});
  507.                 }
  508.             },
  509.  
  510.             agencyMap: function (markers, agency_map_canvas, agency_id) {
  511.  
  512.                 if (agency_map_canvas === undefined || markers.length === 0) {
  513.                     return false;
  514.                 }
  515.  
  516.                 var $tis = this,
  517.                     styles = [],
  518.                     styledMap,
  519.                     myLatlng,
  520.                     mapOptions,
  521.                     map,
  522.                     mapMarkers = [],
  523.                     createMarker,
  524.                     appendAgency = false,
  525.                     i;
  526.  
  527.                 if ($tis.agency_mapInitialLatitude === null) {
  528.                     $tis.agency_mapInitialLatitude = markers[0].latitude;
  529.                 }
  530.  
  531.                 if ($tis.agency_mapInitialLongitude === null) {
  532.                     $tis.agency_mapInitialLongitude = markers[0].longitude;
  533.                 }
  534.  
  535.                 if (agency_id !== undefined || agency_id === null) {
  536.                     myLatlng = new google.maps.LatLng(markers[agency_id].latitude, markers[agency_id].longitude);
  537.                     $tis.agency_initialZoom = $tis.agency_selectedZoom;
  538.                 } else {
  539.                     myLatlng = new google.maps.LatLng($tis.agency_mapInitialLatitude, $tis.agency_mapInitialLongitude);
  540.                 }
  541.  
  542.                 if (!this.use_default_map_style) {
  543.                     styles = [
  544.                         {
  545.                             featureType: "all",
  546.                             elementType: "all",
  547.                             stylers: [
  548.                                 { saturation: -100 }
  549.                             ]
  550.                         }
  551.                     ];
  552.                 }
  553.  
  554.                 styledMap = new google.maps.StyledMapType(styles, {name: "Cozy"});
  555.  
  556.                 mapOptions = {
  557.                     center:  myLatlng,
  558.                     zoom: $tis.agency_initialZoom,
  559.                     scrollwheel: false,
  560.                     panControl: false,
  561.                     mapTypeControl: false,
  562.                     zoomControl: true,
  563.                     zoomControlOptions: {
  564.                         position: google.maps.ControlPosition.RIGHT_CENTER
  565.                     }
  566.                 };
  567.  
  568.                 map = new google.maps.Map(document.getElementById(agency_map_canvas), mapOptions);
  569.  
  570.                 map.mapTypes.set('map_style', styledMap);
  571.                 map.setMapTypeId('map_style');
  572.  
  573.                 createMarker = function (obj) {
  574.  
  575.                     var lat = obj.latitude,
  576.                         lng = obj.longitude,
  577.                         myOptions,
  578.  
  579.                         marker = new google.maps.Marker({
  580.                             position: new google.maps.LatLng(lat, lng),
  581.                             map: map,
  582.                             icon: obj.map_marker_icon
  583.                         }),
  584.  
  585.                         content = '<div class="infoWindowAgency">' + '<h3>' + obj.title + '</h3>' + '<a href="' + obj.link + '"><img src="' + obj.image + '" alt="' + obj.title + '"></a>' + '<div class="description">' + obj.description + '</div>';
  586.  
  587.                     if (obj.link !== "" && obj.link !== undefined) {
  588.                         content += '<div class="center"><a class="btn btn-fullcolor" href="' + obj.link + '">' + $tis.agency_viewMore + '</a></div></div>';
  589.                     } else {
  590.                         content += '</div>';
  591.                     }
  592.  
  593.                     myOptions = {
  594.                         content: content,
  595.                         zIndex: null,
  596.                         alignBottom: true,
  597.                         pixelOffset: new google.maps.Size(-85, -62),
  598.                         closeBoxMargin: "10px 10px 10px 10px",
  599.                         closeBoxURL: "images/close_infobox.png",
  600.                         infoBoxClearance: new google.maps.Size(5, 5),
  601.                         isHidden: false,
  602.                         pane: "floatPane",
  603.                         enableEventPropagation: false
  604.                     };
  605.  
  606.                     mapMarkers.push(marker);
  607.  
  608.                     mapMarkers[mapMarkers.length - 1].infobox = new InfoBox(myOptions);
  609.  
  610.                     google.maps.event.addListener(marker, 'click', function () {
  611.                         $.each(mapMarkers, function () {
  612.                             this.infobox.close();
  613.                         });
  614.  
  615.                         this.infobox.open(map, this);
  616.                     });
  617.                 };
  618.  
  619.                 if (jQuery('#' + agency_map_canvas).parent().parent().find("#agency").length > 0) {
  620.                     appendAgency = true;
  621.                 }
  622.  
  623.                 for (i = 0; i < markers.length; i += 1) {
  624.                     if (markers[i] !== undefined) {
  625.                         createMarker(markers[i]);
  626.  
  627.                         if (appendAgency) {
  628.                             jQuery('#agency').append(jQuery("<option></option>").attr("value", i).text(markers[i].title));
  629.                         }
  630.                     }
  631.                 }
  632.  
  633.                 if (appendAgency) {
  634.                     jQuery("#agency").trigger("liszt:updated");
  635.  
  636.                     jQuery("#agency").chosen().change(function () {
  637.                         var id = jQuery("#agency").val();
  638.                         if (id === "") {
  639.                             map.setZoom($tis.agency_initialZoom);
  640.                             return false;
  641.                         }
  642.  
  643.                         map.setCenter(new google.maps.LatLng(markers[id].latitude, markers[id].longitude));
  644.                         map.setZoom($tis.agency_selectedZoom);
  645.                     });
  646.                 }
  647.             },
  648.  
  649.             propertiesMap: function (markers, properties_map_canvas, property_id) {
  650.  
  651.                 var $tis = this,
  652.                     properties = {},
  653.                     styles = [],
  654.                     styledMap,
  655.                     latlng,
  656.                     options,
  657.                     markerClickFunction,
  658.                     i,
  659.                     latlng2,
  660.                     mkr,
  661.                     fn,
  662.                     mcOptions;
  663.  
  664.                 properties.pics = null;
  665.                 properties.map = null;
  666.                 properties.markerClusterer = null;
  667.                 properties.markers = [];
  668.                 properties.infoWindow = null;
  669.  
  670.                 if (!this.use_default_map_style) {
  671.                     styles = [
  672.                         {
  673.                             featureType: "all",
  674.                             elementType: "all",
  675.                             stylers: [
  676.                                 { saturation: -100 }
  677.                             ]
  678.                         }
  679.                     ];
  680.                 }
  681.  
  682.                 styledMap = new google.maps.StyledMapType(styles, {name: "Cozy"});
  683.  
  684.                 if (property_id !== undefined || property_id === null) {
  685.                     latlng = new google.maps.LatLng(markers[property_id].latitude, markers[property_id].longitude);
  686.                     $tis.properties_initialZoom = $tis.properties_selectedZoom;
  687.                 } else {
  688.                     latlng = new google.maps.LatLng($tis.properties_mapInitialLatitude, $tis.properties_mapInitialLongitude);
  689.                 }
  690.  
  691.                 options = {
  692.                     zoom: $tis.properties_initialZoom,
  693.                     center: latlng,
  694.                     scrollwheel: false
  695.                 };
  696.  
  697.                 properties.map = new google.maps.Map(document.getElementById(properties_map_canvas), options);
  698.                 properties.map.mapTypes.set('map_style', styledMap);
  699.                 properties.map.setMapTypeId('map_style');
  700.  
  701.                 properties.pics = markers;
  702.  
  703.                 properties.infoWindow = new google.maps.InfoWindow({
  704.                     pixelOffset: new google.maps.Size(0, -45)
  705.                 });
  706.  
  707.                 markerClickFunction = function (obj, latlngClik) {
  708.                     return function (e) {
  709.                         e.cancelBubble = true;
  710.                         e.returnValue = false;
  711.                         if (e.stopPropagation) {
  712.                             e.stopPropagation();
  713.                             e.preventDefault();
  714.                         }
  715.  
  716.                         var infoHtml = '<div class="infoWindow">' + '<h3>' + obj.title + '</h3>' + '<a href="' + obj.link + '"><img src="' + obj.image + '" alt="' + obj.title + '"></a>' + '<div class="description">' + obj.description + '</div>';
  717.  
  718.                         if (obj.link !== "" && obj.link !== undefined) {
  719.                             infoHtml += '<div class="right"><a class="btn btn-fullcolor" href="' + obj.link + '">' + $tis.properties_viewMore + '</a></div></div>';
  720.                         } else {
  721.                             infoHtml += '</div>';
  722.                         }
  723.  
  724.                         properties.infoWindow.setContent(infoHtml);
  725.                         properties.infoWindow.setPosition(latlngClik);
  726.                         properties.infoWindow.open(properties.map);
  727.                     };
  728.                 };
  729.  
  730.                 for (i = 0; i < properties.pics.length; i += 1) {
  731.  
  732.                     latlng2 = new google.maps.LatLng(properties.pics[i].latitude, properties.pics[i].longitude);
  733.  
  734.                     mkr = new google.maps.Marker({
  735.                         position: latlng2,
  736.                         map: properties.map,
  737.                         icon: properties.pics[i].map_marker_icon
  738.                     });
  739.  
  740.                     fn = markerClickFunction(properties.pics[i], latlng2);
  741.                     google.maps.event.addListener(mkr, 'click', fn);
  742.                     properties.markers.push(mkr);
  743.                 }
  744.  
  745.                 mcOptions = {
  746.                     styles: [
  747.                         {
  748.                             height: 52,
  749.                             url: $tis.properties_cluster_marker,
  750.                             width: 35,
  751.                             textColor: $tis.properties_cluster_textcolor,
  752.                             anchorText: [-10, 0],
  753.                             textSize: 20,
  754.                             fontWeight: "normal",
  755.                             fontFamily: "Open Sans, Arial, sans-serif"
  756.                         },
  757.                         {
  758.                             height: 52,
  759.                             url: $tis.properties_cluster_marker,
  760.                             width: 35,
  761.                             textColor: $tis.properties_cluster_textcolor,
  762.                             anchorText: [-10, 0],
  763.                             textSize: 20,
  764.                             fontWeight: "normal",
  765.                             fontFamily: "Open Sans, Arial, sans-serif"
  766.                         },
  767.                         {
  768.                             height: 52,
  769.                             url: $tis.properties_cluster_marker,
  770.                             width: 35,
  771.                             textColor: $tis.properties_cluster_textcolor,
  772.                             anchorText: [-10, 0],
  773.                             textSize: 16,
  774.                             fontWeight: "normal",
  775.                             fontFamily: "Open Sans, Arial, sans-serif"
  776.                         }
  777.                     ],
  778.                     maxZoom: 15
  779.                 };
  780.  
  781.                 properties.markerClusterer = new MarkerClusterer(properties.map, properties.markers, mcOptions);
  782.             },
  783.  
  784.             contactsMap: function (markers, map_canvas, map_zoom) {
  785.  
  786.                 var $tis = this,
  787.                     styles = [],
  788.                     styledMap,
  789.                     lng,
  790.                     myLatlng,
  791.                     mapOptions,
  792.                     map,
  793.                     mapMarkers = [],
  794.                     createMarker,
  795.                     i;
  796.  
  797.                 if (map_canvas === undefined || markers.length === 0) {
  798.                     return false;
  799.                 }
  800.  
  801.                 if (map_zoom === undefined || map_zoom === null) {
  802.                     map_zoom = 14;
  803.                 }
  804.  
  805.                 if (!this.use_default_map_style) {
  806.                     styles = [
  807.                         {
  808.                             featureType: "all",
  809.                             elementType: "all",
  810.                             stylers: [
  811.                                 { saturation: -100 }
  812.                             ]
  813.                         }
  814.                     ];
  815.                 }
  816.  
  817.                 styledMap = new google.maps.StyledMapType(styles, {name: "Cozy"});
  818.  
  819.                 if (jQuery(window).innerWidth() <= 751) {
  820.                     lng = markers[0].longitude;
  821.                 } else {
  822.                     lng = markers[0].longitude + 0.03;
  823.                 }
  824.  
  825.                 myLatlng = new google.maps.LatLng(markers[0].latitude, lng);
  826.  
  827.                 mapOptions = {
  828.                     center:  myLatlng,
  829.                     zoom: map_zoom,
  830.                     scrollwheel: false,
  831.                     panControl: false,
  832.                     mapTypeControl: false,
  833.                     zoomControl: true,
  834.                     zoomControlOptions: {
  835.                         position: google.maps.ControlPosition.LEFT_TOP
  836.                     }
  837.                 };
  838.  
  839.                 map = new google.maps.Map(document.getElementById(map_canvas), mapOptions);
  840.  
  841.                 map.mapTypes.set('map_style', styledMap);
  842.                 map.setMapTypeId('map_style');
  843.  
  844.                 createMarker = function (obj) {
  845.  
  846.                     var myOptions,
  847.  
  848.                         marker = new google.maps.Marker({
  849.                             position: new google.maps.LatLng(obj.latitude, obj.longitude),
  850.                             map: map,
  851.                             icon: obj.map_marker_icon
  852.                         }),
  853.  
  854.                         content = '<div class="infoWindowContacts">' + '<h3>' + obj.title + '</h3>' + '<img src="' + obj.image + '" alt="' + obj.title + '">' + '<div class="description">' + obj.description + '</div>';
  855.  
  856.                     if (obj.link !== "" && obj.link !== undefined) {
  857.                         content += '<div class="center"><a class="btn btn-fullcolor" href="' + obj.link + '">' + $tis.agency_viewMore + '</a></div></div>';
  858.                     } else {
  859.                         content += '</div>';
  860.                     }
  861.  
  862.                     myOptions = {
  863.                         content: content,
  864.                         zIndex: null,
  865.                         alignBottom: true,
  866.                         pixelOffset: new google.maps.Size(-85, -62),
  867.                         closeBoxMargin: "10px 10px 10px 10px",
  868.                         closeBoxURL: "images/close_infobox.png",
  869.                         infoBoxClearance: new google.maps.Size(5, 5),
  870.                         isHidden: false,
  871.                         pane: "floatPane",
  872.                         enableEventPropagation: false
  873.                     };
  874.  
  875.                     mapMarkers.push(marker);
  876.  
  877.                     mapMarkers[mapMarkers.length - 1].infobox = new InfoBox(myOptions);
  878.  
  879.                     google.maps.event.addListener(marker, 'click', function () {
  880.                         $.each(mapMarkers, function () {
  881.                             this.infobox.close();
  882.                         });
  883.  
  884.                         this.infobox.open(map, this);
  885.                     });
  886.                 };
  887.  
  888.                 for (i = 0; i < markers.length; i += 1) {
  889.                     if (markers[i] !== undefined) {
  890.                         createMarker(markers[i]);
  891.                     }
  892.                 }
  893.             },
  894.  
  895.             windowResize: function () {
  896.  
  897.                 var $tis = this;
  898.  
  899.                 jQuery(window).resize(function () {
  900.                     var w = jQuery(window).innerWidth();
  901.  
  902.                     $tis.resizeSidebar(w);
  903.                     $tis.createMobileMenu(w);
  904.                 });
  905.             },
  906.  
  907.             stickyNav: function () {
  908.  
  909.                 var $navSection = jQuery('#nav-section');
  910.  
  911.                 $navSection.waypoint('sticky');
  912.  
  913.                 jQuery('body').waypoint(function (dir) {
  914.                     if (dir === "down") {
  915.                         $navSection.addClass('shrink');
  916.                     } else {
  917.                         $navSection.removeClass('shrink');
  918.                     }
  919.                 }, { offset: -320 });
  920.             },
  921.  
  922.             resizeSidebar: function (w) {
  923.  
  924.                 if (w !== null) {
  925.                     w = jQuery(window).innerWidth();
  926.                 }
  927.  
  928.                 if (jQuery(".colored .sidebar").length || jQuery(".gray .sidebar").length) {
  929.                     if (w >= 751) {
  930.                         jQuery(".sidebar").each(function () {
  931.                             var h = jQuery(this).closest(".content").find(".main").height();
  932.                             jQuery(this).css({minHeight: (h + 135) + 'px'});
  933.                         });
  934.                     } else {
  935.                         jQuery(".sidebar").each(function () {
  936.                             jQuery(this).css({"min-height": "0px"});
  937.                         });
  938.                     }
  939.                 }
  940.             },
  941.  
  942.             buttonsClick: function () {
  943.  
  944.                 jQuery("#home-search-buttons > .btn").bind('click', function () {
  945.                     jQuery("#home-search-buttons > .btn").removeClass("active");
  946.                     jQuery(this).addClass("active");
  947.                 });
  948.  
  949.                 jQuery("#opensearch").bind('click', function () {
  950.                     jQuery("#home-advanced-search .container").css({"overflow": "hidden"});
  951.  
  952.                     jQuery("#home-advanced-search").toggleClass("open");
  953.  
  954.                     if (jQuery("#home-advanced-search").hasClass("open")) {
  955.                         setTimeout(function () {
  956.                             jQuery("#home-advanced-search .container").css({"overflow": "visible"});
  957.                         }, 400);
  958.                     }
  959.                 });
  960.  
  961.                 var animating = false,
  962.                     objHeight = 0,
  963.                     objWidth = 0;
  964.  
  965.                 jQuery("#filter-close").bind('click', function () {
  966.                     var $this = jQuery(this);
  967.  
  968.                     if (animating) {
  969.                         return false;
  970.                     }
  971.  
  972.                     animating = true;
  973.  
  974.                     if ($this.hasClass("fa-minus")) {
  975.                         $this.removeClass("fa-minus").addClass("fa-plus");
  976.                         objHeight = jQuery("#map-property-filter .row > div").height();
  977.                         jQuery("#map-property-filter .row > div")
  978.                             .css({"overflow": "hidden"})
  979.                             .animate({"height": "35px", "margin-top": "-83px"}, 300, function () {
  980.                                 jQuery("form", this).css({"visibility": "hidden"});
  981.                                 jQuery(this).animate({"width": "42px"}, 300);
  982.                                 animating = false;
  983.                             });
  984.  
  985.                     } else {
  986.                         $this.removeClass("fa-plus").addClass("fa-minus");
  987.                         jQuery("#map-property-filter .row > div")
  988.                             .animate({"width": "100%"}, 300, function () {
  989.                                 jQuery("form", this).css({"visibility": "visible"});
  990.                                 jQuery(this).animate({"height": objHeight + "px", "margin-top": "-200px"}, 300, function () {
  991.                                     jQuery(this).css({"overflow": "visible", "height": "auto"});
  992.                                     animating = false;
  993.                                 });
  994.                             });
  995.                     }
  996.                 });
  997.  
  998.                 jQuery("#contacts-overlay-close").bind('click', function () {
  999.                     var $this = jQuery(this);
  1000.  
  1001.                     if (animating) {
  1002.                         return false;
  1003.                     }
  1004.  
  1005.                     animating = true;
  1006.  
  1007.                     if ($this.hasClass("fa-minus")) {
  1008.                         $this.removeClass("fa-minus").addClass("fa-plus");
  1009.                         objHeight = jQuery("#contacts-overlay").height();
  1010.                         objWidth = jQuery("#contacts-overlay").width();
  1011.                         jQuery("#contacts-overlay")
  1012.                             .css({"overflow": "hidden"})
  1013.                             .animate({"height": "35px", "margin-top": "-83px"}, 300, function () {
  1014.                                 jQuery("ul", this).css({"visibility": "hidden"});
  1015.                                 jQuery(this).animate({"width": "42px", "min-width": "42px"}, 300);
  1016.                                 animating = false;
  1017.                             });
  1018.  
  1019.                     } else {
  1020.                         $this.removeClass("fa-plus").addClass("fa-minus");
  1021.                         jQuery("#contacts-overlay")
  1022.                             .animate({"min-width": objWidth + "px", "width": "auto"}, 300, function () {
  1023.                                 jQuery("ul", this).css({"visibility": "visible"});
  1024.                                 jQuery(this).animate({"height": objHeight + "px", "margin-top": "-200px"}, 300, function () {
  1025.                                     jQuery(this).css({"overflow": "visible", "height": "auto"});
  1026.                                     animating = false;
  1027.                                 });
  1028.                             });
  1029.                     }
  1030.                 });
  1031.  
  1032.  
  1033.                 //"Slide to" buttons click event
  1034.                 jQuery('[data-slide-to]').click(function (e) {
  1035.                     e.preventDefault();
  1036.  
  1037.                     var d = jQuery("#" + jQuery(this).data('slide-to')).offset().top;
  1038.  
  1039.                     jQuery("html, body").animate({ scrollTop: d - 40 }, 1000, 'easeInOutExpo');
  1040.  
  1041.                     return false;
  1042.                 });
  1043.  
  1044.  
  1045.                 //"Load more" grid items click event
  1046.                 jQuery('[data-load-amount]').click(function (e) {
  1047.                     e.preventDefault();
  1048.  
  1049.                     var $btn = jQuery(this),
  1050.                         amount = $btn.data("load-amount"),
  1051.                         $id = jQuery("#" + $btn.data("grid-id")),
  1052.                         count = 0;
  1053.  
  1054.                     jQuery("div.disabled", $id).each(function () {
  1055.                         if (count < amount) {
  1056.                             jQuery(this).css({ opacity: 0, "margin-top": "-20px" }).removeClass("disabled").animate({ opacity: 1, "margin-top": "0px" }, 500);
  1057.                         }
  1058.                         count += 1;
  1059.                     });
  1060.  
  1061.                     if (!jQuery("div.disabled", $id).length) {
  1062.                         $btn.hide();
  1063.                     }
  1064.  
  1065.                     return false;
  1066.                 });
  1067.             },
  1068.  
  1069.             initCountUp: function () {
  1070.  
  1071.                 var options = {
  1072.                         useEasing : true,
  1073.                         useGrouping : true,
  1074.                         separator : ',',
  1075.                         decimal : '.'
  1076.                     },
  1077.                     timers = [],
  1078.                     checkViewPort;
  1079.  
  1080.                 jQuery(".timer").each(function (i) {
  1081.                     var tis = jQuery(this);
  1082.                     tis.attr("id", "timer" + i);
  1083.                     timers["timer" + i] = new CountUp("timer" + i, 0, parseInt(tis.data("to"), 10), 0, 4.5, options);
  1084.                 });
  1085.  
  1086.                 checkViewPort = function () {
  1087.                     var s = jQuery(window).scrollTop(),
  1088.                         h = jQuery(window).height();
  1089.  
  1090.                     jQuery('.timer').each(function () {
  1091.                         var $this = jQuery(this);
  1092.  
  1093.                         if (s + h >= $this.offset().top) {
  1094.                             timers[$this.attr("id")].start();
  1095.                         }
  1096.                     });
  1097.                 };
  1098.  
  1099.                 jQuery(window).scroll(function () {
  1100.                     checkViewPort();
  1101.                 });
  1102.  
  1103.                 checkViewPort();
  1104.             },
  1105.  
  1106.             contactForm: function () {
  1107.  
  1108.                 var $tis = this;
  1109.  
  1110.                 jQuery(".submit_form").click(function (e) {
  1111.                     e.preventDefault();
  1112.  
  1113.                     var $submit_btn = jQuery(this),
  1114.                         $form = $submit_btn.closest("form"),
  1115.                         $fields = jQuery("input, textarea", $form),
  1116.                         len = 0,
  1117.                         re = /\S+@\S+\.\S+/,
  1118.                         html = "contact",
  1119.                         error = false,
  1120.                         showError,
  1121.                         showSuccess,
  1122.                         stopSpin,
  1123.                         capChallenge,
  1124.                         capResponse;
  1125.  
  1126.                     $fields.each(function () {
  1127.                         var $field = jQuery(this);
  1128.  
  1129.                         if ($field.attr('type') === "hidden") {
  1130.                             if ($field.hasClass('subject')) {
  1131.                                 html += "&subject=" + $field.val();
  1132.                             } else if ($field.hasClass('fromName') || $field.hasClass('fromname')) {
  1133.                                 html += "&fromname=" + $field.val();
  1134.                             } else if ($field.hasClass('fromEmail') || $field.hasClass('fromemail')) {
  1135.                                 html += "&fromemail=" + $field.val();
  1136.                             } else if ($field.hasClass('emailTo') || $field.hasClass('emailto')) {
  1137.                                 html += "&emailto=" + $field.val();
  1138.                             }
  1139.                         } else {
  1140.                             if ($field.hasClass('required') && $field.val() === "") {
  1141.                                 $field.addClass('invalid');
  1142.                                 error = true;
  1143.                             } else if ($field.attr('type') === "email" && $field.val() !== "" && re.test($field.val()) === false) {
  1144.                                 $field.addClass('invalid');
  1145.                                 error = true;
  1146.                             } else if ($field.attr('id') !== "recaptcha_response_field") {
  1147.                                 $field.removeClass('invalid');
  1148.                                 if ($field.hasClass('subject')) {
  1149.                                     html += "&subject=" + $field.val();
  1150.                                     html += "&subject_label=" + $field.attr("name");
  1151.                                 } else if ($field.hasClass('fromName') || $field.hasClass('fromname')) {
  1152.                                     html += "&fromname=" + $field.val();
  1153.                                     html += "&fromname_label=" + $field.attr("name");
  1154.                                 } else if ($field.hasClass('fromEmail') || $field.hasClass('fromemail')) {
  1155.                                     html += "&fromemail=" + $field.val();
  1156.                                     html += "&fromemail_label=" + $field.attr("name");
  1157.                                 } else {
  1158.                                     html += "&field" + len + "_label=" + $field.attr("name");
  1159.                                     html += "&field" + len + "_value=" + $field.val();
  1160.                                     len += 1;
  1161.                                 }
  1162.                             }
  1163.                         }
  1164.                     });
  1165.  
  1166.                     html += "&len=" + len;
  1167.  
  1168.                     showError = function () {
  1169.                         var iClass = jQuery('i', $submit_btn).attr("class");
  1170.  
  1171.                         jQuery('i', $submit_btn).removeClass(iClass).addClass('fa fa-times').delay(1500).queue(function (next) {
  1172.                             jQuery(this).removeClass('fa fa-times').addClass(iClass);
  1173.                             next();
  1174.                         });
  1175.                         $submit_btn.addClass('btn-danger').delay(1500).queue(function (next) {
  1176.                             jQuery(this).removeClass('btn-danger');
  1177.                             next();
  1178.                         });
  1179.                     };
  1180.  
  1181.                     showSuccess = function () {
  1182.                         var iClass = jQuery('i', $submit_btn).attr("class");
  1183.  
  1184.                         jQuery('i', $submit_btn).removeClass(iClass).addClass('fa fa-check').delay(1500).queue(function (next) {
  1185.                             jQuery(this).removeClass('fa fa-check').addClass(iClass);
  1186.                             next();
  1187.                         });
  1188.                         $submit_btn.addClass('btn-success').delay(1500).queue(function (next) {
  1189.                             jQuery(this).removeClass('btn-success');
  1190.                             next();
  1191.                         });
  1192.                     };
  1193.  
  1194.                     stopSpin = function () {
  1195.                         jQuery('i', $submit_btn).removeClass('fa-cog fa-spin').addClass('fa-envelope');
  1196.                         $submit_btn.removeClass('disabled');
  1197.                     };
  1198.  
  1199.                     if (!error && !$tis.sendingMail) {
  1200.                         $tis.sendingMail = true;
  1201.                         jQuery('i', $submit_btn).removeClass('fa-envelope').addClass('fa-cog fa-spin');
  1202.                         $submit_btn.addClass('disabled');
  1203.  
  1204.                         if (jQuery("#recaptcha_response_field").length) {
  1205.                             capChallenge = Recaptcha.get_challenge();
  1206.                             capResponse = Recaptcha.get_response();
  1207.  
  1208.                             $.ajax({
  1209.                                 type: 'POST',
  1210.                                 url: 'recaptcha/verify.php',
  1211.                                 data: 'captcha=' + capResponse + '&challenge=' + capChallenge,
  1212.                                 success: function (json) {
  1213.                                     var result = JSON.parse(json);
  1214.  
  1215.                                     jQuery(".recaptcha_only_if_incorrect").hide();
  1216.  
  1217.                                     if (result.status === 0) {
  1218.                                         jQuery(".recaptcha_only_if_incorrect").show();
  1219.  
  1220.                                         stopSpin();
  1221.                                         showError();
  1222.  
  1223.                                         $tis.sendingMail = false;
  1224.  
  1225.                                     } else if (result.status === 1) {
  1226.                                         $.ajax({
  1227.                                             type: 'POST',
  1228.                                             url: 'contact.php',
  1229.                                             data: html,
  1230.                                             success: function (msg) {
  1231.                                                 stopSpin();
  1232.  
  1233.                                                 if (msg === 'ok') {
  1234.                                                     showSuccess();
  1235.                                                     $form[0].reset();
  1236.                                                 } else {
  1237.                                                     showError();
  1238.                                                 }
  1239.  
  1240.                                                 $tis.sendingMail = false;
  1241.                                             },
  1242.                                             error: function () {
  1243.                                                 stopSpin();
  1244.                                                 showError();
  1245.                                                 $tis.sendingMail = false;
  1246.                                             }
  1247.                                         });
  1248.                                     }
  1249.  
  1250.                                     Recaptcha.reload();
  1251.                                 },
  1252.  
  1253.                                 error: function () {
  1254.                                     stopSpin();
  1255.                                 }
  1256.                             });
  1257.  
  1258.                         } else {
  1259.                             $.ajax({
  1260.                                 type: 'POST',
  1261.                                 url: 'contact.php',
  1262.                                 data: html,
  1263.                                 success: function (msg) {
  1264.                                     stopSpin();
  1265.  
  1266.                                     if (msg === 'ok') {
  1267.                                         showSuccess();
  1268.                                         $form[0].reset();
  1269.                                     } else {
  1270.                                         showError();
  1271.                                     }
  1272.  
  1273.                                     $tis.sendingMail = false;
  1274.                                 },
  1275.                                 error: function () {
  1276.                                     stopSpin();
  1277.  
  1278.                                     showError();
  1279.                                     $tis.sendingMail = false;
  1280.                                 }
  1281.                             });
  1282.                         }
  1283.  
  1284.                     } else {
  1285.                         showError();
  1286.                     }
  1287.  
  1288.                     return false;
  1289.                 });
  1290.             },
  1291.  
  1292.             viewModeSwitcher: function () {
  1293.  
  1294.                 jQuery(".view-mode ul > li").bind('click', function () {
  1295.                     var $btn = jQuery(this),
  1296.                         target = $btn.data("target"),
  1297.                         view = $btn.data("view");
  1298.  
  1299.                     jQuery(">li", jQuery(this).parent()).each(function () {
  1300.                         jQuery(this).removeClass("active");
  1301.                     });
  1302.  
  1303.                     $btn.addClass("active");
  1304.  
  1305.                     jQuery("#" + target).children().animate({ opacity: 0 }, 300, function () {
  1306.                         jQuery("#" + target).removeClass().addClass(view);
  1307.                         jQuery("#" + target).children().animate({ opacity: 1 }, 300);
  1308.                     });
  1309.                 });
  1310.             },
  1311.  
  1312.             animateElems : function () {
  1313.  
  1314.                 var animate = function () {
  1315.                     jQuery('[data-animation-delay]').each(function () {
  1316.                         var $this = jQuery(this),
  1317.                             s = jQuery(window).scrollTop(),
  1318.                             h = jQuery(window).height(),
  1319.                             d = parseInt($this.attr('data-animation-delay'), 10),
  1320.                             dir = $this.data('animation-direction');
  1321.  
  1322.                         if (dir === undefined) {
  1323.                             return false;
  1324.                         }
  1325.  
  1326.                         $this.addClass('animate-' + dir);
  1327.  
  1328.                         if (s + h >= $this.offset().top) {
  1329.                             if (isNaN(d) || d === 0) {
  1330.                                 $this.removeClass('animate-' + dir).addClass('animation-' + dir);
  1331.                             } else {
  1332.                                 setTimeout(function () {
  1333.                                     $this.removeClass('animate-me').addClass('animation-' + dir);
  1334.                                 }, d);
  1335.                             }
  1336.                         }
  1337.                     });
  1338.                 };
  1339.  
  1340.                 if (jQuery(window).innerWidth() >= 751) {
  1341.                     jQuery(window).scroll(function () {
  1342.                         animate();
  1343.                     });
  1344.  
  1345.                     animate();
  1346.                 }
  1347.             }
  1348.  
  1349.         };
  1350.  
  1351.         Cozy.init();
  1352.     });
  1353.     }(jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement