$(window).on( "load", function() { // Check if URL contains # if (window.location.hash) { var hash = window.location.hash.substring(1); // Remove the # symbol if(hash == 'northbound'){ $('#north_bound_btn').click(); $('#north_bound_btn').addClass('onnn'); $('#south_bound_btn').removeClass('onnn'); // Scroll to element after short delay to allow tab switch setTimeout(function() { $('html, body').animate({ scrollTop: $('#north_bound').offset().top - 100 }, 500); }, 500); } } $(".ns_tab_btn a:not(.quick_view)").click(function() { $(".ns_tab_btn a:not(.quick_view)").removeClass('onnn'); $(this).addClass('onnn'); }); $(".quick_view").click(function() { event.preventDefault(); if($(this).hasClass('on')) { $(this).removeClass('on'); //$('.tabstick').removeClass('quick_on'); $('.ns_menu_contain').removeClass('ns_menu_on'); } else { $(this).addClass('on'); //$('.tabstick').addClass('quick_on'); $('.ns_menu_contain').addClass('ns_menu_on'); $('html, body').animate({ scrollTop: $('.tabstick').offset().top }, 800); // 800ms animation duration for smooth scrolling } }); $('body').on('click', function() { if (!$(event.target).closest('.quick_view').length && !$(event.target).closest('.ns_menu_contain').length) { $('.quick_view').removeClass('on'); $('.ns_menu_contain').removeClass('ns_menu_on'); } }); $('.ns_menu_items a').on('click', function() { var anchor = $(this).attr('data-anchor'); if (anchor.indexOf('north_') > -1) { $('#north_bound_btn').click(); }else if (anchor.indexOf('south_') > -1) { $('#south_bound_btn').click(); } $('.quick_view').removeClass('on'); $('.ns_menu_contain').removeClass('ns_menu_on'); setTimeout(function() { $('html, body').animate({ scrollTop: $('#' + anchor).offset().top - 100 }, 500); // 800ms animation duration for smooth scrolling }, 500); }); $('.subtab_btn').click(function() { $(this).parent().find('.subtab_btn').not(this).removeClass('onn'); $(this).addClass('onn'); }); $('.faq_blk .faq_blk_title').click(function() { $(this).find('h4').toggleClass('onn'); $(this).next('.faq_blk_content').slideToggle(); }); $(".links_contain_title").click(function() { $(this).toggleClass('onnn'); $(this).next('.links_contain').slideToggle(); }); // $(".detail_btn").click(function() { // $(this).toggleClass('off'); // $(this).next('.detail_contents').slideToggle(); // }); // $(".it_o_r.showhiii").click(function() { // $(this).toggleClass('active'); // $(this).next('.links_contain').slideToggle(); // }); });