$(document).ready(function(){ $(".builder-guide-wrap").hide(); // HEADER TOGGLE $('#header-toggle').on('click',function(){ $('.header-toggle-wrap').slideToggle(); }); // Menu Toggle $('#menu-toggle-trigger').on('click',function(){ $('.menu-toggle-wrap').slideToggle(); }); $('#menu-toggle-close').on('click',function(){ $('.menu-toggle-wrap').slideToggle(); }); $('.wsite-menu-wrap').on('click',function(){ $(this).find('.wsite-menu').slideToggle(); }); $('#tabs-toggle-trigger').on('click',function(){ $('.tabs-toggle-wrap').slideToggle(); }); // Accordion $('div.accordion-content> .wsite-elements> div.paragraph').hide(); $('div.accordion-content> .wsite-elements> h2').click(function() { $(this).next('.paragraph').slideToggle('fast') .siblings('div:visible').slideUp('fast'); }); // TABS $('.tab-content:not(:first)').hide(); $('#tabs-nav .tab-nav-link').bind('click', function(e) { $this = $(this); $target = $($this.data("target")); // get the target from data attribute $('#tabs-nav .tab-nav-link.current').removeClass('current'); $('.tab-content:visible').fadeOut("fast", function() { $this.addClass('current'); $target.fadeIn("fast"); }); }).filter(':first').click(); }); $(document).scroll(function () { var y = $(this).scrollTop(); if (y > 500) { $('#top-header-wrap').addClass("top-header-position"); } else { $('#top-header-wrap').removeClass("top-header-position"); } var x = $(this).scrollTop(); if (x > 500) { $('.top-header-options').addClass("header-icons-position"); } else { $('.top-header-options').removeClass("header-icons-position"); } }); function goToByScroll(id){ // Remove "link" from the ID id = id.replace("link", ""); // Scroll $('html,body').animate({ scrollTop: $("#"+id).offset().top}, 'slow'); } $("#stbook-addon-nav > div > a").click(function(e) { // Prevent a page reload when a link is pressed e.preventDefault(); // Call the scroll function goToByScroll($(this).attr("id")); });