/* * ---------------------------------------------------------------- * Renown Core JavaScript * ---------------------------------------------------------------- */ jQuery(document).ready(function($){ /* * ---------------------------------------------------------------- * Dropdown menu * ---------------------------------------------------------------- */ $('#navigation > div > ul.menu').dcMegaMenu({ rowItems: '4', speed: 140, effect: 'fade', event: 'hover' }); $('#woo-nav-cart').hoverIntent(function() { $(this).find('.nav-cart-products').stop().fadeIn(); }, function() { $(this).find('.nav-cart-products').stop().delay(400).fadeOut(); }); /* * ---------------------------------------------------------------- * Header Scroll Animation * ---------------------------------------------------------------- */ function vntd_sticky_header() { var navbar = $('#header-main'); var topbar = $(".topbar"); var navbar_height = navbar.height(); var topbar_height = topbar.height(); var logo = $('#logo'); var logo_height = logo.height(); var logo_img = $('#logo img'); var logo_img_height = logo_img.height(); //alert(logo_height); var top; var scroll_max = navbar_height-60; var scroll_start = 1; if(topbar.length !== 0) { scroll_start = topbar_height; scroll_max+=topbar_height; } function vntd_header_resize() { if($(window).width() <= 767) { return false; // Disable on small devices } top = $(this).scrollTop(); if (topscroll_start) { navbar.css({"height": navbar_height-top+topbar_height}); navbar.css({"line-height": navbar_height-top+topbar_height+"px"}); if(logo_img_height > 60 && logo_img_height-top+topbar_height>50) { logo_img.css({"height": logo_img_height-top+topbar_height+"px"}); } } else if(top>=scroll_max) { navbar.css({"height": navbar_height-scroll_max+topbar_height}); navbar.css({"line-height": navbar_height-scroll_max+topbar_height+"px"}); if(logo_img_height > 60) { logo_img.css({"height": "50px"}); } } else { navbar.css({"height": ''}); navbar.css({"line-height": ''}); if(logo_img_height > 60) { logo_img.css({"height": ''}); } } if(topbar.length !== 0) { if(top>1 && top>topbar_height) { topbar.css({"overflow": 'hidden',"height": 0}); topbar.hide(); } else if(top>1) { topbar.css({"overflow": 'hidden',"height": topbar_height-top}); topbar.show(); } else { topbar.css({"overflow": 'visible',"height": ''}); topbar.show(); } } if($('#wrapper').hasClass('header-style-bottom')) { if(top>1 && top>topbar_height+logo_height) { logo.css({"height": 0}); logo.hide(); } else if(top>topbar_height) { logo.css({"height": logo_height-top+topbar_height}); //alert(logo_height+" "+top+" "+topbar_height); logo.show(); } else { logo.css({"height": ''}); logo.show(); } } } vntd_header_resize(); jQuery(window).scroll(function(){ vntd_header_resize(); }); //var logo_height = $('#logo img').height(); } // Fire the Sticky Header script if enabled if($(".fixed-navbar").length !== 0) vntd_sticky_header(); jQuery('#vntd-mobile-nav-toggle').toggle(function() { jQuery('#mobile-navigation').slideDown(400); //jQuery('#mobile-navigation').slideDown(400).find('.sub-menu').find('.sub-menu').delay(300).animate({'paddingLeft': '15px'},300); }, function () { // jQuery('#mobile-navigation').find('.sub-menu').animate({'paddingLeft': '0'},200); jQuery('#mobile-navigation').delay(200).slideUp(400); }); /* * ---------------------------------------------------------------- * Image Hover * ---------------------------------------------------------------- */ $('.hover-item').hover(function() { $(this).find('.hover-overlay').animate({'opacity':.5},200); }, function() { $(this).find('.hover-overlay').animate({'opacity':0},200); }); /* * ---------------------------------------------------------------- * Scrol To Top Button * ---------------------------------------------------------------- */ function vntd_scroll_button() { if (jQuery(window).scrollTop()>300) { jQuery('#scroll-to-top').fadeIn(400); } else { jQuery('#scroll-to-top').fadeOut(); } } vntd_scroll_button(); jQuery(window).scroll(function(){ vntd_scroll_button(); }); jQuery('#scroll-to-top').click(function() { jQuery("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); /* * ---------------------------------------------------------------- * Header Search Bar * ---------------------------------------------------------------- */ jQuery(".nav-search form").click(function(event){ event.stopPropagation(); }); jQuery(document).click(function(event){ var clicked = $("#nav-search").data('clicked'); jQuery('#nav-search .nav-search-holder').fadeOut(200); $("#nav-search").data("clicked", ""); event.stopPropagation(); }); jQuery("#nav-search").click(function(event){ var clicked = $(this).data('clicked'); var nav = $(this).find('.nav-search-holder'); if(clicked) { $(nav).fadeOut(200); } else { $(nav).fadeIn(200).find('input').focus(); } $(this).data("clicked", !clicked); event.stopPropagation(); }); /* * ---------------------------------------------------------------- * Shortcodes * ---------------------------------------------------------------- */ // Accordion jQuery('.accordions > .toggle:first-child .toggle-title').addClass("accordion-active"); jQuery('.accordions > .toggle .toggle-title').click(function() { jQuery(this).closest('.accordions').find('.toggle-title').removeClass("accordion-active"); jQuery(this).addClass("accordion-active"); jQuery(this).closest('.accordions').find('.toggle-content').slideUp(); jQuery(this).next().slideDown(); return false; }); // Toggles jQuery('.toggles .toggle .toggle-title').toggle(function() { jQuery(this).addClass("toggle-active"); jQuery(this).next().slideDown(250); }, function() { jQuery(this).removeClass("toggle-active"); jQuery(this).next().slideUp(250); }); // Social Icons Break remove jQuery('.social-icon').next('br').remove(); // Alert boxes jQuery('.alert-box .alert-close').click(function(){ jQuery(this).parent().fadeTo(300, 0).slideUp(); }); prettyPhoto(); /* * ---------------------------------------------------------------- * Image Fade In Effect * ---------------------------------------------------------------- */ $('img.img-appear, .img-appear img').each(function() { $(this).appear(function() { $(this).delay(200).animate({ 'opacity':1, 'left':0 }); }); }); function flexslider_init(){ $('.vntd-flexslider').each(function() { $(this).flexslider({ smoothHeight: true }); }); } flexslider_init(); }); /* * ---------------------------------------------------------------- * PrettyPhoto * ---------------------------------------------------------------- */ function prettyPhoto() { jQuery("a[rel^='gallery'], a[rel='prettyPhoto']").prettyPhoto({ animation_speed:'fast', theme:'pp_default', deeplinking:false, slideshow:3000, social_tools:'' }); } jQuery(window).load(function ($) { /* * ---------------------------------------------------------------- * Parallax Effect * ---------------------------------------------------------------- */ $window = jQuery(window); jQuery('.vntd-parallax').mousemove(function(e){ var amountMovedX = (e.pageX * -1 / 6); var amountMovedY = (e.pageY * -1 / 6); jQuery(window).scroll(function() { var yPos = -($window.scrollTop() / 10); // Put together our final background position var coords = '50% '+ yPos + 'px'; // Move the background $bgobj.css({ backgroundPosition: coords }); }); }); });