Efectos Javascript para sitios de una sola página - One page

jQuery(document).ready(function($){ jQuery("#main_navigation li.menu-item a").addClass("nav-link");//Menu principal / main nav jQuery("li#menu-item-10 a").addClass("active");//Menu principal / main nav jQuery(".vc_icon_element-link").addClass("nav-link");//Menu principal / main nav // Smooth scrolling using jQuery easing $('.js-scroll-trigger a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); if (target.length) { $('html, body').animate({ scrollTop: (target.offset().top - 30) }, 900, "easeInOutQuad"); return false; } } }); // Closes responsive menu when a scroll trigger link is clicked $('.js-scroll-trigger a').click(function() { $('.navbar-collapse').collapse('hide'); }); // Activate scrollspy to add active class to navbar items on scroll $('body').scrollspy({ target: '#main_navigation', offset: 54 }); jQuery(".mobile_nav_button").click(function(){ jQuery(this).toggleClass('nav_activated'); jQuery("#navigation_wrap").toggleClass("show_on_mobile animated fadeInDown"); }); jQuery(".nav-link").click(function(){ jQuery("#navigation_wrap").removeClass("show_on_mobile"); }); jQuery(".search-field").focus(function(){ jQuery(".search-form").addClass("search_box_full_screen"); }); jQuery(".search-form").click(function(){ jQuery(this).removeClass("search_box_full_screen"); }); }); /*Add and remove class on scroll for dynamic fixed header height*/ jQuery(window).scroll(function() { var scroll = jQuery(window).scrollTop(); if (scroll >= 300) { jQuery("#header_wrap").addClass("fixed_navigation animated fadeInDown"); jQuery("#back-top").addClass("go_top_active animated fadeInUp"); } else { jQuery("#header_wrap").removeClass("fixed_navigation animated fadeInDown"); jQuery("#back-top").removeClass("go_top_active animated fadeInUp"); } });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.