1/*----------------------------------------------------*/ 2/* Sticky Header 3/*----------------------------------------------------*/ 4function initStickyHeader() { 5 $("#header").not("#header-container.header-style-2 #header").clone(true).addClass('cloned unsticky').insertAfter("#header"); 6 $("#navigation.style-2").clone(true).addClass('cloned unsticky').insertAfter("#navigation.style-2"); 7 8 // Logo for header style 2 9 $("#logo .sticky-logo").clone(true).prependTo("#navigation.style-2.cloned ul#responsive"); 10 11 12 // sticky header script 13 var headerOffset = $("#header-container").height() * 2; // height on which the sticky header will shows 14 15 $(window).scroll(function () { 16 if ($(window).scrollTop() >= headerOffset) { 17 $("#header.cloned").addClass('sticky').removeClass("unsticky"); 18 $("#navigation.style-2.cloned").addClass('sticky').removeClass("unsticky"); 19 } else { 20 $("#header.cloned").addClass('unsticky').removeClass("sticky"); 21 $("#navigation.style-2.cloned").addClass('unsticky').removeClass("sticky"); 22 } 23 }); 24} 25 26 27/* ----------------- Start Document ----------------- */ 28(function($){ 29"use strict"; 30 31$(document).ready(function(){ 32 33 /*--------------------------------------------------*/ 34 /* Mobile Menu - mmenu.js 35 /*--------------------------------------------------*/ 36 $(function() { 37 function mmenuInit() { 38 var wi = $(window).width(); 39 if(wi <= '992') { 40 41 $('#footer').removeClass("sticky-footer"); 42 43 $(".mmenu-init" ).remove(); 44 $("#navigation").clone().addClass("mmenu-init").insertBefore("#navigation").removeAttr('id').removeClass('style-1 style-2').find('ul').removeAttr('id'); 45 $(".mmenu-init").find(".container").removeClass("container"); 46 47 $(".mmenu-init").mmenu({ 48 "counters": true 49 }, { 50 // configuration 51 offCanvas: { 52 pageNodetype: "#wrapper" 53 } 54 }); 55 56 var mmenuAPI = $(".mmenu-init").data( "mmenu" ); 57 var $icon = $(".hamburger"); 58 59 $(".mmenu-trigger").click(function() { 60 mmenuAPI.open(); 61 }); 62 63 mmenuAPI.bind( "open:finish", function() { 64 setTimeout(function() { 65 $icon.addClass( "is-active" ); 66 }); 67 }); 68 mmenuAPI.bind( "close:finish", function() { 69 setTimeout(function() { 70 $icon.removeClass( "is-active" ); 71 }); 72 }); 73 74 75 } 76 $(".mm-next").addClass("mm-fullsubopen"); 77 } 78 mmenuInit(); 79 $(window).resize(function() { mmenuInit(); }); 80 }); 81 82 /* User Menu */ 83 $('.user-menu').on('click', function(){ 84 $(this).toggleClass('active'); 85 }); 86 87 /*----------------------------------------------------*/ 88 /* Animation homepage 89 /*----------------------------------------------------*/ 90 // Plugin @RokoCB :: Return the visible amount of px 91 // of any element currently in viewport. 92 // stackoverflow.com/questions/24768795/ 93 ;(function($, win) { 94 $.fn.inViewport = function(cb) { 95 return this.each(function(i,el){ 96 function visPx(){ 97 var H = $(this).height(), 98 r = el.getBoundingClientRect(), t=r.top, b=r.bottom; 99 return cb.call(el, Math.max(0, t>0? H-t : (b<H?b:H))); 100 } visPx(); 101 $(win).on("resize scroll", visPx); 102 }); 103 }; 104 }(jQuery, window)); 105 106 $(".properties_animation").inViewport(function(px){ 107 if(px) $(this).addClass("slideInUp") ; 108 }); 109 110 111 /*----------------------------------------------------*/ 112 /* Top Bar Dropdown Menu 113 /*----------------------------------------------------*/ 114 115 $('.top-bar-dropdown').on('click', function(event){ 116 $('.top-bar-dropdown').not(this).removeClass('active'); 117 if ($(event.target).parent().parent().attr('class') == 'options' ) { 118 hideDD(); 119 } else { 120 if($(this).hasClass('active') && $(event.target).is( "span" )) { 121 hideDD(); 122 } else { 123 $(this).toggleClass('active'); 124 } 125 } 126 event.stopPropagation(); 127 }); 128 129 $(document).on('click', function(e){ hideDD(); }); 130 131 function hideDD(){ 132 $('.top-bar-dropdown').removeClass('active'); 133 } 134 135 136 /*----------------------------------------------------*/ 137 /* Advanced Search Button 138 /*----------------------------------------------------*/ 139 $('#map-container .adv-search-btn').on('click', function(e){ 140 141 if ( $(this).is(".active") ) { 142 143 $(this).removeClass("active"); 144 $(".main-search-container").removeClass("active"); 145 setTimeout( function() { 146 $("#map-container.homepage-map").removeClass("overflow") 147 }, 0); 148 149 } else { 150 151 $(this).addClass("active"); 152 $(".main-search-container").addClass("active"); 153 setTimeout( function() { 154 $("#map-container.homepage-map").addClass("overflow") 155 }, 400); 156 157 } 158 159 e.preventDefault(); 160 }); 161 162 /*----------------------------------------------------*/ 163 /* MOBILE sorting and filtres 164 /*----------------------------------------------------*/ 165 166 $(".bottomBoxSortShow").click(function() { 167 $(".sorting-mobile-container").toggleClass('expanded'); 168 }); 169 $(".filtersMobileShow").click(function(e) { 170 e.preventDefault(); 171 $(".mobile-filters").toggleClass('expanded'); 172 }); 173 174 175 $('#category-type-id-2').change(function(){ 176 if($(this).val() == '1' ){ 177 $('#category-type-id input[value="1"]').prop("checked", true); 178 } 179 if($(this).val() == '2' ){ 180 $('#category-type-id input[value="2"]').prop("checked", true); 181 } 182 if($(this).val() == '3' ){ 183 $('#category-type-id input[value="3"]').prop("checked", true); 184 } 185 }); 186 187 188 /*----------------------------------------------------*/ 189 /* Inline CSS replacement for backgrounds etc. 190 /*----------------------------------------------------*/ 191 function inlineCSS() { 192 193 // Common Inline CSS 194 $(".some-classes, section.fullwidth, .img-box-background, .flip-banner, .property-slider .item, .fullwidth-property-slider .item, .fullwidth-home-slider .item, .address-container").each(function() { 195 var attrImageBG = $(this).attr('data-background-image'); 196 var attrColorBG = $(this).attr('data-background-color'); 197 198 if(attrImageBG !== undefined) { 199 $(this).css('background-image', 'url('+attrImageBG+')'); 200 } 201 202 if(attrColorBG !== undefined) { 203 $(this).css('background', ''+attrColorBG+''); 204 } 205 }); 206 207 } 208 209 // Init 210 inlineCSS(); 211 212 function parallaxBG() { 213 214 $('.parallax').prepend('<div class="parallax-overlay"></div>'); 215 216 $( ".parallax").each(function() { 217 var attrImage = $(this).attr('data-background'); 218 var attrColor = $(this).attr('data-color'); 219 var attrOpacity = $(this).attr('data-color-opacity'); 220 221 if(attrImage !== undefined) { 222 $(this).css('background-image', 'url('+attrImage+')'); 223 } 224 225 if(attrColor !== undefined) { 226 $(this).find(".parallax-overlay").css('background-color', ''+attrColor+''); 227 } 228 229 if(attrOpacity !== undefined) { 230 $(this).find(".parallax-overlay").css('opacity', ''+attrOpacity+''); 231 } 232 233 }); 234 } 235 236 parallaxBG(); 237 238 239 // Slide to anchor
240 $('#titlebar .listing-address').on('click', function(e){ 241 e.preventDefault(); 242 243 $('html, body').animate({ 244 scrollTop: $( $.attr(this, 'href') ).offset().top-40 245 }, 600); 246 }); 247 248 249 /*----------------------------------------------------*/ 250 /* Tooltips 251 /*----------------------------------------------------*/ 252 253 $(".tooltip.top").tipTip({ 254 defaultPosition: "top" 255 }); 256 257 $(".tooltip.bottom").tipTip({ 258 defaultPosition: "bottom" 259 }); 260 261 $(".tooltip.left").tipTip({ 262 defaultPosition: "left" 263 }); 264 265 $(".tooltip.right").tipTip({ 266 defaultPosition: "right" 267 }); 268 269 270 /*----------------------------------------------------*/ 271 /* Parallax 272 /*----------------------------------------------------*/ 273 274 /* detect touch */ 275 if("ontouchstart" in window){ 276 document.documentElement.className = document.documentElement.className + " touch"; 277 } 278 if(!$("html").hasClass("touch")){ 279 /* background fix */ 280 $(".parallax").css("background-attachment", "fixed"); 281 } 282 283 /* fix vertical when not overflow 284 call fullscreenFix() if .fullscreen content changes */ 285 function fullscreenFix(){ 286 var h = $('body').height(); 287 // set .fullscreen height 288 $(".content-b").each(function(i){ 289 if($(this).innerHeight() > h){ $(this).closest(".fullscreen").addClass("overflow"); 290 } 291 }); 292 } 293 $(window).resize(fullscreenFix); 294 fullscreenFix(); 295 296 /* resize background images */ 297 function backgroundResize(){ 298 var windowH = $(window).height(); 299 $(".parallax").each(function(i){ 300 var path = $(this); 301 // variables 302 var contW = path.width(); 303 var contH = path.height(); 304 var imgW = path.attr("data-img-width"); 305 var imgH = path.attr("data-img-height"); 306 var ratio = imgW / imgH; 307 // overflowing difference 308 var diff = 100; 309 diff = diff ? diff : 0; 310 // remaining height to have fullscreen image only on parallax 311 var remainingH = 0; 312 if(path.hasClass("parallax") && !$("html").hasClass("touch")){ 313 //var maxH = contH > windowH ? contH : windowH; 314 remainingH = windowH - contH; 315 } 316 // set img values depending on cont 317 imgH = contH + remainingH + diff; 318 imgW = imgH * ratio; 319 // fix when too large 320 if(contW > imgW){ 321 imgW = contW; 322 imgH = imgW / ratio; 323 } 324 // 325 path.data("resized-imgW", imgW); 326 path.data("resized-imgH", imgH); 327 path.css("background-size", imgW + "px " + imgH + "px"); 328 }); 329 } 330 331 332 $(window).resize(backgroundResize); 333 $(window).focus(backgroundResize); 334 backgroundResize(); 335 336 /* set parallax background-position */ 337 function parallaxPosition(e){ 338 var heightWindow = $(window).height(); 339 var topWindow = $(window).scrollTop(); 340 var bottomWindow = topWindow + heightWindow; 341 var currentWindow = (topWindow + bottomWindow) / 2; 342 $(".parallax").each(function(i){ 343 var path = $(this); 344 var height = path.height(); 345 var top = path.offset().top; 346 var bottom = top + height; 347 // only when in range 348 if(bottomWindow > top && topWindow < bottom){ 349 //var imgW = path.data("resized-imgW"); 350 var imgH = path.data("resized-imgH"); 351 // min when image touch top of window 352 var min = 0; 353 // max when image touch bottom of window 354 var max = - imgH + heightWindow; 355 // overflow changes parallax 356 var overflowH = height < heightWindow ? imgH - height : imgH - heightWindow; // fix height on overflow 357 top = top - overflowH; 358 bottom = bottom + overflowH; 359 360 361 // value with linear interpolation 362 // var value = min + (max - min) * (currentWindow - top) / (bottom - top); 363 var value = 0; 364 if ( $('.parallax').is(".titlebar") ) { 365 value = min + (max - min) * (currentWindow - top) / (bottom - top) *2; 366 } else { 367 value = min + (max - min) * (currentWindow - top) / (bottom - top); 368 } 369 370 // set background-position 371 var orizontalPosition = path.attr("data-oriz-pos"); 372 orizontalPosition = orizontalPosition ? orizontalPosition : "50%"; 373 $(this).css("background-position", orizontalPosition + " " + value + "px"); 374 } 375 }); 376 } 377 if(!$("html").hasClass("touch")){ 378 $(window).resize(parallaxPosition); 379 //$(window).focus(parallaxPosition); 380 $(window).scroll(parallaxPosition); 381 parallaxPosition(); 382 } 383 384 // Jumping background fix for IE 385 if(navigator.userAgent.match(/Trident\/7\./)) { // if IE 386 $('body').on("mousewheel", function () { 387 event.preventDefault(); 388 389 var wheelDelta = event.wheelDelta; 390 var currentScrollPosition = window.pageYOffset; 391 window.scrollTo(0, currentScrollPosition - wheelDelta); 392 }); 393 } 394 395 396 /*----------------------------------------------------*/ 397 /* Search Type Buttons 398 /*----------------------------------------------------*/ 399 function searchTypeButtons() { 400 401 // Radio attr reset 402 $('.search-type label.active input[type="radio"]').prop('checked',true); 403 404 } 405 406 // Init 407 if ($(".main-search-form").length){ 408 searchTypeButtons(); 409 $(window).on('load resize', function() { searchTypeButtons(); }); 410 } 411 412 413 /*----------------------------------------------------*/ 414 /* Chosen Plugin 415 /*----------------------------------------------------*/ 416 417 var config = { 418 '.chosen-select' : {disable_search_threshold: 10, width:"100%"}, 419 '.chosen-select-deselect' : {allow_single_deselect:true, width:"100%"}, 420 '.chosen-select-no-single' : {disable_search_threshold:100, width:"100%"}, 421 '.chosen-select-no-single.no-search' : {disable_search_threshold:10, width:"100%"}, 422 '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'}, 423 '.chosen-select-width' : {width:"95%"} 424 }; 425 426 for (var selector in config) { 427 if (config.hasOwnProperty(selector)) { 428 $(selector).chosen(config[selector]); 429 } 430 } 431 432 433 /* Custom Input With Select 434 /*----------------------------------------------------*/ 435 $('.select-input').each(function(){ 436 437 var thisContainer = $(this); 438 var $this = $(this).children('select'), numberOfOptions = $this.children('option').length; 439 440 $this.addClass('select-hidden'); 441 $this.wrap('<div class="select"></div>'); 442 $this.after('<div class="select-styled"></div>'); 443 var $styledSelect = $this.next('div.select-styled'); 444 $styledSelect.text($this.children('option').eq(0).text()); 445 446 var $list = $('<ul />', { 447 'class': 'select-options' 448 }).insertAfter($styledSelect); 449 450 for (var i = 0; i < numberOfOptions; i++) { 451 $('<li />', { 452 text: $this.children('option').eq(i).text(), 453 rel: $this.children('option').eq(i).val() 454 }).appendTo($list); 455 } 456 457 var $listItems = $list.children('li'); 458 459 $list.wrapInner('<div class="select-list-container"></div>'); 460 461 462 $(this).children('input').on('click', function(e){ 463 $('.select-options').hide(); 464 e.stopPropagation(); 465 $styledSelect.toggleClass('active').next('ul.select-options').toggle(); 466 }); 467 468 $(this).children('input').keypress(function() { 469 $styledSelect.removeClass('active'); 470 $list.hide(); 471 }); 472 473 474 $listItems.on('click', function(e){ 475 e.stopPropagation(); 476 // $styledSelect.text($(this).text()).removeClass('active'); 477 $(thisContainer).children('input').val( $(this).text() ).removeClass('active'); 478 $this.val($(this).attr('rel')); 479 $list.hide(); 480 //console.log($this.val()); 481 }); 482 483 $(document).on('click', function(e){ 484 $styledSelect.removeClass('active'); 485 $list.hide(); 486 }); 487 488 489 // Unit character 490 var fieldUnit = $(this).children('input').attr('data-unit'); 491 $(this).children('input').before('<i class="data-unit">'+ fieldUnit + '</i>'); 492 493 494 }); 495 496 497 498 /*----------------------------------------------------*/ 499 /* Searh Form More Options 500 /*----------------------------------------------------*/ 501 var tags = false;
502 $('.more-search-options-trigger').on('click', function(e){ 503 e.preventDefault(); 504 $('.more-search-options, .more-search-options-trigger').toggleClass('active'); 505 $('.more-search-options.relative').animate({height: 'toggle', opacity: 'toggle'}, 300); 506 507 if ($(window).width() < 991) { 508 if(tags == false){ 509 tags = true; 510 $('.mobile-button').appendTo('.add-button'); 511 } else { 512 tags = false; 513 $('.mobile-button').appendTo('.remove-button'); 514 } 515 return false; 516 } 517 }); 518 $(window).resize(function() { 519 if ($(window).width() > 991) { 520 $('.mobile-button').appendTo('.remove-button'); 521 } 522 }); 523 524 525 /*----------------------------------------------------*/ 526 /* Compare Menu 527 /*----------------------------------------------------*/ 528 $('.csm-trigger').on('click', function(){ 529 $('.compare-slide-menu').toggleClass('active'); 530 }); 531 532 $('.csm-mobile-trigger').on('click', function(){ 533 $('.compare-slide-menu').removeClass('active'); 534 }); 535 536 // Tooltips 537 $(".compare-button.with-tip, .print.with-tip, .widget-button.with-tip, .clause.with-tip, .data.with-tip").each(function() { 538 var tipContent = $(this).attr('data-tip-content'); 539 $(this).append('<div class="tip-content">'+ tipContent + '</div>'); 540 }); 541 542 // Demo Purpose Trigger 543 $('.compare-button, .compare-widget-button').on('click', function(){ 544 $('.compare-slide-menu').addClass('active'); 545 }); 546 547 $(".remove-from-compare").on('click', function(e){ 548 e.preventDefault(); 549 }); 550 551 552 /*----------------------------------------------------*/ 553 /* Like Icon Trigger 554 /*----------------------------------------------------*/ 555 $('.widget-button').on('click', function(e){ 556 e.preventDefault(); 557 $(this).toggleClass('liked'); 558 $(this).children('.print').toggleClass('liked'); 559 }); 560 561 $('.print').on('click', function(e){ 562 window.open($(this).data('link'), '', 'left=100,top=100,width=800,height=600,scrollbars=yes,toolbar=no,resizable=yes,status=yes'); 563 return false; 564 }); 565 566 $('.print-property').on('click', function(e){ 567 window.open($(this).data('link'), '', 'left=100,top=100,width=800,height=600,scrollbars=yes,toolbar=no,resizable=yes,status=yes'); 568 return false; 569 }); 570 /*----------------------------------------------------*/ 571 /* Show More Button 572 /*----------------------------------------------------*/ 573 $('.show-more-button').on('click', function(e){ 574 e.preventDefault(); 575 if ($(this).hasClass('show-more-button-closest-only')) { 576 $(this).closest('.show-more').toggleClass('visible'); 577 } else { 578 $('.show-more').toggleClass('visible'); 579 } 580 }); 581 582 583 /*----------------------------------------------------*/ 584 /* Back to Top 585 /*----------------------------------------------------*/ 586 var pxShow = 600; // height on which the button will show 587 var fadeInTime = 300; // how slow / fast you want the button to show 588 var fadeOutTime = 300; // how slow / fast you want the button to hide 589 var scrollSpeed = 500; // how slow / fast you want the button to scroll to top. 590 591 $(window).scroll(function(){ 592 if($(window).scrollTop() >= pxShow){ 593 $("#backtotop").fadeIn(fadeInTime); 594 } else { 595 $("#backtotop").fadeOut(fadeOutTime); 596 } 597 }); 598 599 $('#backtotop a').on('click', function(){ 600 $('html, body').animate({scrollTop:0}, scrollSpeed); 601 return false; 602 }); 603 604 605 /*----------------------------------------------------*/ 606 /* Owl Carousel 607 /*----------------------------------------------------*/ 608 609 $('.branch-carousel').owlCarousel({ 610 autoPlay: true, 611 navigation: false, 612 navigationText: '', 613 slideSpeed: 600, 614 items : 1, 615 itemsDesktop : [1239,1], 616 itemsTablet : [991,1], 617 itemsMobile : [767,1] 618 }); 619 620 $('.special-offers').owlCarousel({ 621 autoPlay: false, 622 navigation: true, 623 navigationText: '', 624 slideSpeed: 600, 625 items : 2, 626 itemsDesktop : [1239,2], 627 itemsTablet : [991,2], 628 itemsMobile : [767,1] 629 }); 630 631 $('.carousel').owlCarousel({ 632 autoPlay: false, 633 navigation: true, 634 navigationText: '', 635 slideSpeed: 600, 636 items : 3, 637 itemsDesktop : [1239,3], 638 itemsTablet : [991,2], 639 itemsMobile : [767,1] 640 }); 641 642 $('.logo-carousel').owlCarousel({
643 autoPlay: false, 644 navigation: true, 645 slideSpeed: 600, 646 items : 5, 647 itemsDesktop : [1239,4], 648 itemsTablet : [991,3], 649 itemsMobile : [767,1] 650 }); 651 652 653 $('.owl-next, .owl-prev').on("click", function (e) { 654 e.preventDefault(); 655 }); 656 657 /*----------------------------------------------------*/ 658 /* Slick Carousel 659 /*----------------------------------------------------*/ 660 $('.property-slider').slick({ 661 slidesToShow: 1, 662 slidesToScroll: 1, 663 arrows: true, 664 fade: true, 665 asNavFor: '.property-slider-nav', 666 centerMode: true, 667 slide: ".item", 668 adaptiveHeight: true 669 }); 670 671 $('.property-slider-nav').slick({ 672 slidesToShow: 6, 673 slidesToScroll: 1, 674 asNavFor: '.property-slider', 675 dots: false, 676 arrows: false, 677 centerMode: false, 678 focusOnSelect: true, 679 responsive: [ 680 { 681 breakpoint: 993, 682 settings: { 683 slidesToShow: 4, 684 } 685 }, 686 { 687 breakpoint: 767, 688 settings: { 689 slidesToShow: 3, 690 } 691 } 692 ] 693 }); 694 695 696 $('.fullwidth-property-slider').slick({ 697 centerMode: true, 698 centerPadding: '0', 699 slidesToShow: 1, 700 slidesToScroll: 1, 701 lazyLoad:'ondemand', 702 responsive: [ 703 { 704 breakpoint: 1367, 705 settings: { 706 centerPadding: '0' 707 } 708 }, 709 { 710 breakpoint: 993, 711 settings: { 712 centerPadding: '0', 713 adaptiveHeight: true 714 } 715 } 716 ] 717 }); 718 719 var sdelay = typeof slidesDelay !== typeof undefined ? slidesDelay : 7000; 720 721 $('.fullwidth-home-slider').slick({ 722 centerMode: true, 723 centerPadding: '0', 724 slidesToShow: 1, 725 autoplay: true, 726 autoplaySpeed: sdelay, 727 responsive: [ 728 { 729 breakpoint: 1367, 730 settings: { 731 centerPadding: '0' 732 } 733 }, 734 { 735 breakpoint: 993, 736 settings: { 737 centerPadding: '0', 738 adaptiveHeight: true 739 } 740 } 741 ] 742 }); 743 744 745 746 /*----------------------------------------------------*/ 747 /* Magnific Popup 748 /*----------------------------------------------------*/ 749 $('body').magnificPopup({ 750 type: 'image', 751 delegate: 'a.mfp-gallery', 752 753 fixedContentPos: true, 754 fixedBgPos: true, 755 756 overflowY: 'auto', 757 758 closeBtnInside: false, 759 preloader: true, 760 761 removalDelay: 0, 762 mainClass: 'mfp-fade', 763 764 gallery:{enabled:true} 765 }); 766 767 768 $('.popup-with-zoom-anim').magnificPopup({ 769 type: 'inline', 770 771 fixedContentPos: false, 772 fixedBgPos: true, 773 774 overflowY: 'auto', 775 776 closeBtnInside: true, 777 preloader: false, 778 779 midClick: true, 780 removalDelay: 300, 781 mainClass: 'my-mfp-zoom-in' 782 }); 783 784 785 $('.mfp-image').magnificPopup({ 786 type: 'image', 787 closeOnContentClick: true, 788 mainClass: 'mfp-fade', 789 image: { 790 verticalFit: true 791 } 792 }); 793 794 $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({ 795 disableOn: 700, 796 type: 'iframe', 797 mainClass: 'mfp-fade', 798 removalDelay: 160, 799 preloader: false, 800 801 fixedContentPos: false 802 }); 803 804 805 /*----------------------------------------------------*/ 806 /* Sticky Footer (footer-reveal.js) 807 /*----------------------------------------------------*/ 808 809 // disable if IE 810 if(navigator.userAgent.match(/Trident\/7\./)) { // if IE 811 $('#footer').removeClass("sticky-footer"); 812 } 813 814 $('#footer.sticky-footer').footerReveal(); 815 816 817 /*----------------------------------------------------*/ 818 /* Image Box 819 /*----------------------------------------------------*/ 820 $('.img-box').each(function(){ 821 822 // add a photo container 823 $(this).append('<div class="img-box-background"></div>'); 824 825 // set up a background image for each tile based on data-background-image attribute 826 $(this).children('.img-box-background').css({'background-image': 'url('+ $(this).attr('data-background-image') +')'}); 827 828 // background animation on mousemove 829 // $(this).on('mousemove', function(e){ 830 // $(this).children('.img-box-background').css({'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 +'%'}); 831 // }) 832 }); 833 834 835 836 /*----------------------------------------------------*/ 837 /* Range Sliders 838 /*----------------------------------------------------*/ 839 840 // Area Range 841 $("#area-range").each(function() { 842 843 var dataMin = $(this).attr('data-min'); 844 var dataMax = $(this).attr('data-max'); 845 var dataUnit = $(this).attr('data-unit'); 846 847 $(this).append( "<input type='text' class='first-slider-value'disabled/><input type='text' class='second-slider-value' disabled/>" ); 848 849 $(this).slider({ 850 851 range: true, 852 min: dataMin, 853 max: dataMax, 854 step: 10, 855 values: [ dataMin, dataMax ], 856 857 slide: function( event, ui ) { 858 event = event; 859 $(this).children( ".first-slider-value" ).val( ui.values[ 0 ] + " " + dataUnit ); 860 $(this).children( ".second-slider-value" ).val( ui.values[ 1 ] + " " + dataUnit ); 861 } 862 }); 863 $(this).children( ".first-slider-value" ).val( $( this ).slider( "values", 0 ) + " " + dataUnit ); 864 $(this).children( ".second-slider-value" ).val( $( this ).slider( "values", 1 ) + " " + dataUnit ); 865 866 }); 867 868 869 // Price Range 870 $("#price-range").each(function() { 871 872 var dataMin = $(this).attr('data-min'); 873 var dataMax = $(this).attr('data-max'); 874 var dataUnit = $(this).attr('data-unit'); 875 876 $(this).append( "<input type='text' class='first-slider-value' disabled/><input type='text' class='second-slider-value' disabled/>" ); 877 878 879 $(this).slider({ 880 881 range: true, 882 min: dataMin, 883 max: dataMax, 884 values: [ dataMin, dataMax ], 885 886 slide: function( event, ui ) { 887 event = event; 888 $(this).children( ".first-slider-value" ).val( dataUnit + ui.values[ 0 ].toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 889 $(this).children( ".second-slider-value" ).val( dataUnit + ui.values[ 1 ].toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 890 } 891 }); 892 $(this).children( ".first-slider-value" ).val( dataUnit + $( this ).slider( "values", 0 ).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 893 $(this).children( ".second-slider-value" ).val( dataUnit + $( this ).slider( "values", 1 ).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 894 895 896 }); 897 898 899 900 /*----------------------------------------------------*/ 901 /* Masonry 902 /*----------------------------------------------------*/ 903 904 // Agent Profile Alignment 905 $(window).on('load resize', function() { 906 907 //$('.agents-grid-container').masonry({ 908 // itemSelector: '.grid-item', // use a separate class for itemSelector, other than .col- 909 // columnWidth: '.grid-item', 910 // percentPosition: true 911 //}); 912 913 var agentAvatarHeight = $(".agent-avatar img").height(); 914 var agentContentHeight = $(".agent-content").innerHeight(); 915 916 if ( agentAvatarHeight < agentContentHeight ) { 917 $('.agent-page').addClass('long-content'); 918 } else { 919 $('.agent-page').removeClass('long-content'); 920 } 921 }); 922 923 924 925 /*----------------------------------------------------*/ 926 /* Submit Property 927 /*----------------------------------------------------*/ 928 929 // Tooltip 930 $(".tip").each(function() { 931 var tipContent = $(this).attr('data-tip-content'); 932 $(this).append('<div class="tip-content">'+ tipContent + '</div>'); 933 }); 934 935 936 937 /*----------------------------------------------------*/ 938 /* Tabs 939 /*----------------------------------------------------*/ 940 941 var $tabsNav = $('.tabs-nav'), 942 $tabsNavLis = $tabsNav.children('li'); 943 944 $tabsNav.each(function() { 945 var $this = $(this); 946 947 $this.next().children('.tab-content').stop(true,true).hide() 948 .first().show(); 949 950 $this.children('li').first().addClass('active').stop(true,true).show(); 951 }); 952 953 $tabsNavLis.on('click', function(e) { 954 var $this = $(this); 955 956 $this.siblings().removeClass('active').end() 957 .addClass('active'); 958 959 $this.parent().next().children('.tab-content').stop(true,true).hide() 960 .siblings( $this.find('a').attr('href') ).fadeIn(); 961 962 e.preventDefault(); 963 }); 964 var hash = window.location.hash; 965 var anchor = $('.tabs-nav a[href="' + hash + '"]'); 966 if (anchor.length === 0) { 967 $(".tabs-nav li:first").addClass("active").show(); //Activate first tab 968 $(".tab-content:first").show(); //Show first tab content 969 } else { 970 console.log(anchor); 971 anchor.parent('li').click(); 972 } 973 974 975 /*----------------------------------------------------*/ 976 /* Accordions 977 /*----------------------------------------------------*/ 978 var $accor = $('.accordion'); 979 980 $accor.each(function() { 981 $(this).toggleClass('ui-accordion ui-widget ui-helper-reset'); 982 $(this).find('h3').addClass('ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all'); 983 $(this).find('div').addClass('ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom'); 984 $(this).find("div").hide(); 985 }); 986 987 var $trigger = $accor.find('h3'); 988 989 $trigger.on('click', function(e) { 990 var location = $(this).parent(); 991 992 if( $(this).next().is(':hidden') ) { 993 var $triggerloc = $('h3',location); 994 $triggerloc.removeClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideUp(300); 995 $triggerloc.find('span').removeClass('ui-accordion-icon-active'); 996 $(this).find('span').addClass('ui-accordion-icon-active'); 997 $(this).addClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideDown(300); 998 } 999 else if( $(this).is(':visible') ) { 1000 var $triggerloc = $('h3',location); 1001 $triggerloc.removeClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideUp(300); 1002 $triggerloc.find('span').removeClass('ui-accordion-icon-active'); 1003 } 1004 e.preventDefault(); 1005 }); 1006 1007 1008 1009 /*----------------------------------------------------*/ 1010 /* Toggle 1011 /*----------------------------------------------------*/ 1012 1013 $(".toggle-container").hide(); 1014 1015 $('.trigger, .trigger.opened').on('click', function(a){ 1016 $(this).toggleClass('active'); 1017 a.preventDefault(); 1018 }); 1019 1020 $(".trigger").on('click', function(){ 1021 $(this).next(".toggle-container").slideToggle(300); 1022 }); 1023 1024 $(".trigger.opened").addClass("active").next(".toggle-container").show(); 1025 1026 1027 /*----------------------------------------------------*/ 1028 /* Contact Form 1029 /*----------------------------------------------------*/ 1030 1031 var shake = "No"; 1032 1033 $('#message').hide(); 1034 1035 // Add validation parts 1036 $('#contact input[type=text], #contact input[type=number], #contact input[type=email], #contact input[type=url], #contact input[type=tel], #contact select, #contact textarea').each(function(){ 1037 1038 }); 1039 1040 // Validate as you type 1041 $('#name, #comments, #subject').focusout(function() { 1042 if (!$(this).val()) { 1043 $(this).addClass('error').parent().find('mark').removeClass('valid').addClass('error'); 1044 } 1045 else { 1046 $(this).removeClass('error').parent().find('mark').removeClass('error').addClass('valid'); 1047 } 1048 $('#submit') 1049 .prop('disabled',false) 1050 .removeClass('disabled'); 1051 }); 1052 $('#email').focusout(function() { 1053 if (!$(this).val() || !isEmail($(this).val())) { 1054 $(this).addClass('error').parent().find('mark').removeClass('valid').addClass('error'); 1055 } else { 1056 $(this).removeClass('error').parent().find('mark').removeClass('error').addClass('valid'); 1057 } 1058 }); 1059 1060 $('#email').focusin(function() { 1061 $('#submit') 1062 .prop('disabled',false) 1063 .removeClass('disabled'); 1064 }); 1065 1066 $('#submit').click(function() { 1067 $("#contact-message").slideUp(200,function() { 1068 $('#contact-message').hide(); 1069
1070 // Kick in Validation 1071 $('#name, #subject, #phone, #comments, #website, #email').triggerHandler("focusout"); 1072 1073 if ($('#contact mark.error').size()>0) { 1074 if(shake == "Yes") { 1075 $('#contact').effect('shake', { times:2 }, 75, function(){ 1076 $('#contact input.error:first, #contact textarea.error:first').focus(); 1077 }); 1078 } else $('#contact input.error:first, #contact textarea.error:first').focus(); 1079 1080 return false; 1081 } 1082 1083 }); 1084 }); 1085 1086 $('#contactform').submit(function(){ 1087 1088 if ($('#contact mark.error').size()>0) { 1089 if(shake == "Yes") { 1090 $('#contact').effect('shake', { times:2 }, 75); 1091 } 1092 return false; 1093 } 1094 1095 var action = $(this).attr('action'); 1096 1097 $('#contact #submit').after('<img src="images/loader.gif" class="loader" />') 1098 1099 $('#submit') 1100 .prop('disabled',true) 1101 .addClass('disabled'); 1102 1103 $.post(action, $('#contactform').serialize(), 1104 function(data){ 1105 $('#contact-message').html( data ); 1106 $('#contact-message').slideDown(); 1107 $('#contactform img.loader').fadeOut('slow',function(){$(this).remove()}); 1108 // $('#contactform #submit').removeAttr('disabled'); 1109 if(data.match('success') != null) $('#contactform').slideUp('slow'); 1110 1111 } 1112 ); 1113 1114 return false; 1115 1116 }); 1117 1118 function isEmail(emailAddress) { 1119 1120 var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); 1121 1122 return pattern.test(emailAddress); 1123 } 1124 1125 function isNumeric(input) { 1126 return (input - 0) == input && input.length > 0; 1127 } 1128 1129 1130 1131// ------------------ End Document ------------------ // 1132}); 1133 1134})(this.jQuery); 1135 1136 1137 1138(function($) { 1139 1140 $.fn.footerReveal = function(options) { 1141 1142 $('#footer.sticky-footer').before('<div class="footer-shadow"></div>'); 1143 1144 var $this = $(this), 1145 $prev = $this.prev(), 1146 $win = $(window), 1147 1148 defaults = $.extend ({ 1149 shadow : true, 1150 shadowOpacity: 0.12, 1151 zIndex : -10 1152 }, options ), 1153 1154 settings = $.extend(true, {}, defaults, options); 1155 1156 $this.before('<div class="footer-reveal-offset"></div>'); 1157 1158 if ($this.outerHeight() <= $win.outerHeight()) { 1159 $this.css({ 1160 'z-index' : defaults.zIndex, 1161 position : 'fixed', 1162 bottom : 0 1163 }); 1164 1165 $win.on('load resize', function() { 1166 $this.css({ 1167 'width' : $prev.outerWidth() 1168 }); 1169 $prev.css({ 1170 'margin-bottom' : $this.outerHeight() 1171 }); 1172 }); 1173 } 1174 1175 return this; 1176 1177 }; 1178 1179}) (this.jQuery); 1180 1181 1182 1183 1184 1185/* ================================================== 1186 CUSTOM JS 1187 ================================================== */ 1188 1189$(window).on('load',function(){ 1190 if(Cookies.get('card-popup') != 'load') { 1191 $('#card-popup').modal('show'); 1192 } 1193 1194 $('#card-popup').on('hidden.bs.modal', function (e) { 1195 Cookies.set('card-popup', 'load', { expires: 1 }); 1196 }); 1197}); 1198 1199function format_number(number, prefix, thousand_separator, decimal_separator) 1200{ 1201 var thousand_separator = thousand_separator || ',', 1202 decimal_separator = decimal_separator || '.', 1203 regex = new RegExp('[^' + decimal_separator + '\\d]', 'g'), 1204 number_string = number.replace(regex, '').toString(), 1205 split = number_string.split(decimal_separator), 1206 rest = split[0].length % 3, 1207 result = split[0].substr(0, rest), 1208 thousands = split[0].substr(rest).match(/\d{3}/g); 1209 1210 if (thousands) { 1211 separator = rest ? thousand_separator : ''; 1212 result += separator + thousands.join(thousand_separator); 1213 } 1214 result = split[1] != undefined ? result + decimal_separator + split[1] : result; 1215 return prefix == undefined ? result : (result ? prefix + result : ''); 1216}; 1217 1218function limit_character(event) 1219{
1220 key = event.which || event.keyCode; 1221 if ( key != 188 // Comma 1222 && key != 190 // Dot 1223 && key != 8 // Backspace 1224 && key != 46 // Delete 1225 && key != 37 // left 1226 && key != 39 // right 1227 && key != 17 && key != 86 & key != 67 // Ctrl c, ctrl v 1228 && (key < 48 || key > 57) // Non digit 1229 && (key < 95 || key > 106) // Numeric keypad 1230 // And many more, such as: del, left arrow dan right arrow, tab, etc... 1231 ) 1232 { 1233 event.preventDefault(); 1234 return false; 1235 } 1236} 1237 1238$('.separator-input') 1239 .each(function() { 1240 $(this).val(format_number(this.value, '', ' ', ',')); 1241 }) 1242 .on('keyup', function() { 1243 $(this).val(format_number(this.value, '', ' ', ',')); 1244 }) 1245 .on('keydown', function(event) { 1246 limit_character(event); 1247 }); 1248 1249function fbs_click() { 1250 u = location.href; 1251 t = document.title; 1252 window.open('https://www.facebook.com/share.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'share', 'toolbar=0,status=0,width=626,height=436'); 1253 return false; 1254}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.