/* ----------------- Start Document ----------------- */ (function($){ /*======== Doucument Ready Function =========*/ jQuery(document).ready(function () { //CACHE JQUERY OBJECTS $("#status").fadeOut(); $("#preloader").delay(200).fadeOut("slow"); $("body").delay(200).css({ "overflow": "visible" }); /* Init Wow Js */ new WOW().init(); }); "use strict"; $(document).ready(function(){ /*--------------------------------------------------*/ /* Navigation /*--------------------------------------------------*/ var jPanelMenu = $.jPanelMenu({ menu: '#responsive', animated: false, duration: 200, keyboardShortcuts: false, closeOnContentClick: true }); // Menu Trigger $('.menu-trigger').on('click', function(){ var jpm = $(this); if( jpm.hasClass('active') ) { jPanelMenu.off(); jpm.removeClass('active'); } else { jPanelMenu.on(); jPanelMenu.open(); jpm.addClass('active'); // Removes SuperFish Styles $('#jPanelMenu-menu').removeClass('menu'); $('ul#jPanelMenu-menu li').removeClass('dropdown'); $('ul#jPanelMenu-menu li ul').removeAttr('style'); $('ul#jPanelMenu-menu li div').removeClass('mega').removeAttr('style'); $('ul#jPanelMenu-menu li div div').removeClass('mega-container'); } return false; }); $(window).resize(function (){ var winWidth = $(window).width(); if(winWidth>992) { jPanelMenu.close(); } }); /* User Menu */ $('.user-menu').on('click', function(){ $(this).toggleClass('active'); }); /*----------------------------------------------------*/ /* Sticky Header /*----------------------------------------------------*/ $( "#header" ).not( "#header.not-sticky" ).clone(true).addClass('cloned unsticky').insertAfter( "#header" ); $( "#navigation.style-2" ).clone(true).addClass('cloned unsticky').insertAfter( "#navigation.style-2" ); // Logo for header style 2 $( "#logo .sticky-logo" ).clone(true).prependTo("#navigation.style-2.cloned ul#responsive"); // sticky header script var headerOffset = $("#header-container").height() * 2; // height on which the sticky header will shows $(window).scroll(function(){ if($(window).scrollTop() >= headerOffset){ $("#header.cloned").addClass('sticky').removeClass("unsticky"); $("#navigation.style-2.cloned").addClass('sticky').removeClass("unsticky"); } else { $("#header.cloned").addClass('unsticky').removeClass("sticky"); $("#navigation.style-2.cloned").addClass('unsticky').removeClass("sticky"); } }); /*----------------------------------------------------*/ /* Back to Top /*----------------------------------------------------*/ var pxShow = 600; // height on which the button will show var scrollSpeed = 500; // how slow / fast you want the button to scroll to top. $(window).scroll(function(){ if($(window).scrollTop() >= pxShow){ $("#backtotop").addClass('visible'); } else { $("#backtotop").removeClass('visible'); } }); $('#backtotop a').on('click', function(){ $('html, body').animate({scrollTop:0}, scrollSpeed); return false; }); /*----------------------------------------------------*/ /* Inline CSS replacement for backgrounds etc. /*----------------------------------------------------*/ function inlineCSS() { // Common Inline CSS $(".main-search-container, section.fullwidth, .listing-slider .item, .address-container, .img-box-background, .image-edge, .edge-bg").each(function() { var attrImageBG = $(this).attr('data-background-image'); var attrColorBG = $(this).attr('data-background-color'); if(attrImageBG !== undefined) { $(this).css('background-image', 'url('+attrImageBG+')'); } if(attrColorBG !== undefined) { $(this).css('background', ''+attrColorBG+''); } }); } // Init inlineCSS(); function parallaxBG() { $('.parallax').prepend('
'); $( ".parallax").each(function() { var attrImage = $(this).attr('data-background'); var attrColor = $(this).attr('data-color'); var attrOpacity = $(this).attr('data-color-opacity'); if(attrImage !== undefined) { $(this).css('background-image', 'url('+attrImage+')'); } if(attrColor !== undefined) { $(this).find(".parallax-overlay").css('background-color', ''+attrColor+''); } if(attrOpacity !== undefined) { $(this).find(".parallax-overlay").css('opacity', ''+attrOpacity+''); } }); } parallaxBG(); /*----------------------------------------------------*/ /* Image Box /*----------------------------------------------------*/ $('.category-box').each(function(){ // add a photo container $(this).append(''); // set up a background image for each tile based on data-background-image attribute $(this).children('.category-box-background').css({'background-image': 'url('+ $(this).attr('data-background-image') +')'}); // background animation on mousemove // $(this).on('mousemove', function(e){ // $(this).children('.category-box-background').css({'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 +'%'}); // }) }); /*----------------------------------------------------*/ /* Image Box /*----------------------------------------------------*/ $('.img-box').each(function(){ $(this).append(''); $(this).children('.img-box-background').css({'background-image': 'url('+ $(this).attr('data-background-image') +')'}); }); /*----------------------------------------------------*/ /* Toggle /*----------------------------------------------------*/ $(".toggle-container").hide(); $('.trigger, .trigger.opened').on('click', function(a){ $(this).toggleClass('active'); a.preventDefault(); }); $(".trigger").on('click', function(){ $(this).next(".toggle-container").slideToggle(300); }); $(".trigger.opened").addClass("active").next(".toggle-container").show(); /*----------------------------------------------------*/ /* Like Icon Trigger /*----------------------------------------------------*/ $('.like-icon, .widget-button, .like-button').on('click', function(e){ e.preventDefault(); $(this).toggleClass('liked'); $(this).children('.like-icon').toggleClass('liked'); }); /*----------------------------------------------------*/ /* Searh Form More Options /*----------------------------------------------------*/ $('.more-search-options-trigger').on('click', function(e){ e.preventDefault(); $('.more-search-options, .more-search-options-trigger').toggleClass('active'); $('.more-search-options.relative').animate({height: 'toggle', opacity: 'toggle'}, 300); }); /*----------------------------------------------------*/ /* Rating Script Init /*----------------------------------------------------*/ // Leave Rating $('.leave-rating input').change(function () { var $radio = $(this); $('.leave-rating .selected').removeClass('selected'); $radio.closest('label').addClass('selected'); }); /*----------------------------------------------------*/ /* Dashboard Scripts /*----------------------------------------------------*/ $('.dashboard-nav ul li a').on('click', function(){ if ($(this).closest('li').has('ul').length) { $(this).parent('li').toggleClass('active'); } }); // Dashbaord Nav Scrolling $(window).on('load resize', function() { var wrapperHeight = window.innerHeight; var headerHeight = $("#header-container").height(); var winWidth = $(window).width(); if(winWidth>992) { $(".dashboard-nav-inner").css('max-height', wrapperHeight-headerHeight-180); } else { $(".dashboard-nav-inner").css('max-height', ''); } }); // Tooltip $(".tip").each(function() { var tipContent = $(this).attr('data-tip-content'); $(this).append('