jQuery(document).ready(function () { initMobileNav(); initAnchors(); main_menu_events(); wow.init(); jQuery(window).resize(function () { jQuery('.menu .dropdown-link').unbind(); main_menu_events(); }); function updateStyle(elem) { const shadow = elem.shadowRoot; var style = document.createElement('style'); style.textContent = '.hblgw .__hblgw--nowrap-nowrap{ font-family: "Montserrat", "Arial", "Helvetica Neue", "Helvetica", sans-serif; margin: 0 0 0.5em;margin-bottom: 0.5em;color: #322e3f;font-weight: 600;font-size: 52px;line-height: 56px;display: inline-block;margin-bottom: 32px;letter-spacing: -0.8px;}' + '.hblgw .__hblgw--input-input{-webkit-appearance: none; -webkit-border-radius: 0; box-sizing: border-box; font-size: 16px; line-height: 20px; font-family: inherit; background: transparent; border: 1px solid #a2a2a3; border-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; box-shadow: none; color: #676676; height: 64px; margin: 0; margin-bottom: 0px; padding: 21px 15px 21px; width: 100%; display: block; outline: none;height: 74px !important;padding: 26px 15px 26px 32px;}' + '.hblgw .__hblgw--button-container{cursor: pointer;font-family: "Montserrat", "Arial", "Helvetica Neue", "Helvetica", sans-serif;letter-spacing: 0.6px;-webkit-font-smoothing: antialiased;padding: 19px 32px;height: 74px;border-color: #a2a2a3;border-width: 1px 1px 1px 0;border-radius: 0 8px 8px 0;background-color: #322e3f;display: block;width: auto;font-weight: 600;color: #fff;display: inline-flex;flex-flow: row wrap;justify-content: center;align-items: center;text-align: center;text-transform: uppercase;transition: all 0.3s ease;vertical-align: top;outline: none;position: absolute;top: 0;right: 0;}' + '.hblgw .__hblgw--button-container:hover{background-color: '+OBJECT.base_color+';border-color: '+OBJECT.base_color+';}' + '.hblgw .__hblgw--input-container{position:relative;max-width: 665px;border: 0 none;}' + '.hblgw .__hblgw--bothead-container svg{width:21px}' + '.hblgw .__hblgw--heading-container{text-align: left;margin-bottom: 0;}' + '.hblgw .__hblgw--name-name svg{width:70px}' + '.hblgw .__hblgw--widget-container{font-family: "Montserrat", "Arial", "Helvetica Neue", "Helvetica", sans-serif;margin: unset;max-width: unset;padding: 0;}' + '.hblgw .__hblgw--name-name svg path{fill:#0000006E}' + '.hblgw .__hblgw--logo-container{display:inline-block}' + '.hblgw .__hblgw--message-message{display:inline-block;font-size: 16px;line-height: 26px;font-weight: 400;color: rgba(0, 0, 0, 0.43);}' + '.hblgw .__hblgw--bothead-container{margin: 0px 8px 0 0;display:inline-block;height: 22px;vertical-align: middle;padding-left: 5px;padding-right: 5px;}' + '.hblgw .__hblgw--name-name{display:inline-block;width: unset;height: unset;}' + '.hblgw .__hblgw--logo-message{display: flex;display:-ms-flex;justify-content: flex-end;max-width: 665px;margin-top: 20px;}' + '@media only screen and (max-width: 1220px) {.hblgw .__hblgw--nowrap-nowrap{font-size: 42px;line-height: 46px;}}' + '@media only screen and (max-width: 991px) {.hblgw .__hblgw--input-container{max-width: 100%;}.hblgw .__hblgw--logo-message{max-width: 100%;}}'+ '@media only screen and (max-width: 600px) {.hblgw .__hblgw--nowrap-nowrap{font-size: 26px;line-height: 28px;}.hblgw .__hblgw--nowrap-nowrap{margin-bottom: 20px;}}'+ '@media only screen and (max-width: 480px) {.hblgw .__hblgw--input-input{height: 60px !important;padding: 20px 15px 20px 32px;}.hblgw .__hblgw--button-container{height: 60px;}}'+ '@media only screen and (max-width: 380px) {.hblgw .__hblgw--nowrap-nowrap{font-size: 20px;line-height: 20px;}.hblgw .__hblgw--button-container {padding: 19px 16px;font-size: 12px;}}' // shadow.innerHTML = ''+shadow.innerHTML; shadow.appendChild(style); } if (document.head.createShadowRoot || document.head.attachShadow) { jQuery("#homebot_homeowner").css('visibility','hidden'); setTimeout(function () { var _homebot = document.querySelector('#homebot_homeowner'); updateStyle(_homebot); jQuery("#homebot_homeowner").css('visibility','visible'); },2000); } else { document.getElementById('homebot--worth-display').style.display = 'block'; } }); // mobile menu init function initMobileNav() { // if(Modernizr.mq('(max-width: 1024px)')){ jQuery('body').mobileNav({ menuActiveClass: 'nav-active', menuOpener: '.nav-opener', hideOnClickOutside: true, menuDrop: '.nav-holder' }); // } } // initialize smooth anchor links function initAnchors() { jQuery('a[href^="#"]').on('click',function (e) { e.preventDefault(); var target = this.hash, $target = jQuery(target); jQuery('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 900, 'swing'); setTimeout(function () { jQuery(".worth-from #email").focus(); }, 200); }); } // initialize wow animate js wow = new WOW( { animateClass: 'animated', offset: 100, callback: function(box) { console.log("WOW: animating <" + box.tagName.toLowerCase() + ">") } } ); // logo preszie // setTimeout(function(){ // presize('.logo', 207 , 71); // },100); // autofocus form input setTimeout(function () { jQuery(".worth-from #email").focus(); }, 200); /* * sticky header */ jQuery('#sticky-header' ).waypoint(function(direction){ var _sticky_header = jQuery('.header'); if (direction == "down") { setTimeout(function () { _sticky_header.css({ 'position': 'fixed', 'background-color': '#fff' }); _sticky_header.addClass('header_sticky'); jQuery('body').removeClass('nav-active'); _sticky_header.hide().slideDown('fast'); },200); } else { _sticky_header.css({ 'position': 'absolute', 'background-color': 'transparent' }); _sticky_header.removeClass('header_sticky'); } }); /* * main menu on hover */ function main_menu_events() { if(jQuery(window).width() <= 991) { // Mobile jQuery('.header_sticky .menu .dropdown-link').on('click' , 'a',function(e){ e.preventDefault(); }); jQuery('.header_sticky .menu .dropdown-link ul li:not(.vcfoobox) .menu__link').click(function(e){ e.stopPropagation(); }); jQuery('.menu .dropdown-link').click(function(e){ if(jQuery(this).hasClass('open')){ _this = jQuery(this); jQuery(this).find('.dropdown').stop().slideUp(300 , function(){ _this.removeClass('open'); jQuery(".nano").nanoScroller({ alwaysVisible: true, }); }); }else{ jQuery('.dropdown').slideUp('fast'); jQuery('.menu .dropdown-link').delay(1500).removeClass('open'); jQuery(this).addClass('open'); jQuery(this).find('.dropdown').stop().slideDown(); jQuery(".nano").nanoScroller({ alwaysVisible: true, }); } }); } else { // Desktop console.info('here'); jQuery('.menu .dropdown-link').mouseover(function(){ jQuery(this).addClass('open'); jQuery(this).find('.dropdown').stop().slideDown(); }).mouseleave(function(){ _this = jQuery(this); jQuery(this).find('.dropdown').stop().slideUp(300 , function(){ _this.removeClass('open'); }); }); jQuery(".nano").nanoScroller({ destroy: true }); } } /* * initialize msCustomScrollbar */ /*function nanoScroller() { var window_height = jQuery(window).height(); var header_height = jQuery('.header').height(); var max_height = window_height - header_height; jQuery('.nav-holder__area').css({"maxHeight": max_height - 25}); if(window_height <= max_height + header_height) { if(jQuery(window).width() < 992 ) { jQuery(".nano").nanoScroller({ alwaysVisible: true, }); /!*jQuery('.nav-holder__area').nanoScroller({ scrollbarPosition: "outside" });*!/ } else { jQuery(".nano").nanoScroller({ destroy: true }); /!*jQuery('.nav-holder__area').nanoScroller('destroy');*!/ } } else { jQuery(".nano").nanoScroller({ destroy: true }); /!*jQuery('.nav-holder__area').nanoScroller('destroy');*!/ } }*/ /* * logo preszie */ // function presize($obj, w, h) { // var nw = jQuery('body').find($obj).width(), // nh = jQuery('body').find($obj).height(); // if ((nw > w) && w > 0) { // nw = w; // nh = (w / jQuery('body').find($obj).width()) * jQuery('body').find($obj).height(); // } // if ((nh > h) && h > 0) { // nh = h; // nw = (h / jQuery('body').find($obj).height()) * jQuery('body').find($obj).width(); // } // xscale = jQuery('body').find($obj).width() / nw; // yscale = jQuery('body').find($obj).height() / nh; // jQuery('body').find($obj).css({'max-width':nw , 'max-height':nh}); // } /* * Simple Mobile Navigation */ (function($) { function MobileNav(options) { this.options = $.extend({ container: null, hideOnClickOutside: false, menuActiveClass: 'nav-active', menuOpener: '.nav-opener', menuDrop: '.nav-drop', toggleEvent: 'click', outsideClickEvent: 'click touchstart pointerdown MSPointerDown' }, options); this.initStructure(); this.attachEvents(); } MobileNav.prototype = { initStructure: function() { this.page = jQuery('html'); this.window = $(window); this.container = jQuery(this.options.container); this.opener = this.container.find(this.options.menuOpener); this.drop = this.container.find(this.options.menuDrop); }, attachEvents: function() { var self = this; if(activateResizeHandler) { activateResizeHandler(); activateResizeHandler = null; } this.outsideClickHandler = function(e) { if(self.isOpened()) { var target = jQuery(e.target); if(!target.closest(self.opener).length && !target.closest(self.drop).length) { self.hide(); } } }; this.openerClickHandler = function(e) { e.preventDefault(); self.toggle(); }; this.opener.on(this.options.toggleEvent, this.openerClickHandler); }, isOpened: function() { return this.container.hasClass(this.options.menuActiveClass); }, show: function() { this.container.addClass(this.options.menuActiveClass); if(this.options.hideOnClickOutside) { this.page.on(this.options.outsideClickEvent, this.outsideClickHandler); } }, hide: function() { this.container.removeClass(this.options.menuActiveClass); if(this.options.hideOnClickOutside) { this.page.off(this.options.outsideClickEvent, this.outsideClickHandler); } }, toggle: function() { if(this.isOpened()) { this.hide(); } else { this.show(); } }, destroy: function() { this.container.removeClass(this.options.menuActiveClass); this.opener.off(this.options.toggleEvent, this.clickHandler); this.page.off(this.options.outsideClickEvent, this.outsideClickHandler); } }; var activateResizeHandler = function() { var win = jQuery(window), doc = jQuery('html'), resizeClass = 'resize-active', flag, timer; var removeClassHandler = function() { flag = false; doc.removeClass(resizeClass); }; var resizeHandler = function() { if(!flag) { flag = true; doc.addClass(resizeClass); } clearTimeout(timer); timer = setTimeout(removeClassHandler, 500); }; win.on('resize orientationchange', resizeHandler); }; $.fn.mobileNav = function(opt) { var args = Array.prototype.slice.call(arguments); var method = args[0]; return this.each(function() { var $container = jQuery(this); var instance = $container.data('MobileNav'); if (typeof opt === 'object' || typeof opt === 'undefined') { $container.data('MobileNav', new MobileNav($.extend({ container: this }, opt))); } else if (typeof method === 'string' && instance) { if (typeof instance[method] === 'function') { args.shift(); instance[method].apply(instance, args); } } }); }; $('a.button-play').fancybox({ // type: 'iframe', padding: 0, width: 1008, height: 576, aspectRatio: true, scrolling: 'no', // beforeLoad: function() { // var url= $(this.element).data("src"); // this.href = url // }, buttons: [ "close" ], helpers: { media: true }, youtube: { autoplay: 1, // enable autoplay } }); }(jQuery));