(function( $ ){ function scrollToHash( on_page_load ){ if( window.location.hash == undefined || window.location.hash == ""){ return ;} var hash_text = window.location.hash.replace("#", ""); var scroll_h = $("#nx_masthead").height() + 15; if( on_page_load == true ) { var elm = false; if( $("#"+hash_text).length ) { elm = $("#"+hash_text); } else if( $("[name='"+hash_text+"']").length ) { elm = $("[name='"+hash_text+"']"); } if( elm != false ) { $('html, body').animate({ 'scrollTop': $(elm).offset().top - scroll_h }, 1000); } } else { window.scrollBy(0, -scroll_h); } }//end function $(document).ready(function(){ /* var controller_doc_link = $('.nginx-doc-sidenav li a[href="https://www.nginx.com/products/nginx-controller/"]'); if( controller_doc_link.length ) { $(controller_doc_link).attr("href", "/"); $(controller_doc_link).parent().addClass('has-sub-nav'); $(controller_doc_link).parent().append('
'); } */ $('.nginx-doc-sidenav li').each(function(){ if($(this).find('ul').length>0){ $(this).prepend(""); $(this).addClass('has-sub-nav'); $(this).find('ul').addClass('sub-side-nav'); } if($(this).hasClass('current')){ $(this).children('ul').css('display','block'); } }); $('.nginx-doc-sidenav .open-sidenav').on('click',function(){ $(this).parent('li').toggleClass('current'); $(this).siblings('.sub-side-nav').slideToggle(100); return false; }); //when I click on an item on the TOC that has a dropdown, instead of going to the table of contents page, it should open the dropdown. $('.nginx-doc-sidenav a').on('click',function(){ var sub_menu = $(this).next('.sub-side-nav'); if( sub_menu.length ) { $(this).parent('li').toggleClass('current'); $(this).siblings('.sub-side-nav').slideToggle(100); return false; /* sub_menu_first_link = $(sub_menu).children('li').first().children('a').first(); if(sub_menu_first_link.length) { var this_is_current = $(this).hasClass('current'); var fl_is_current = $(sub_menu_first_link).hasClass('current'); var fl_has_hash = ($(sub_menu_first_link).attr('href').indexOf("#") != -1) ? true : false; if( fl_is_current || ( !fl_is_current && !fl_has_hash ) ) { $(this).parent('li').toggleClass('current'); $(this).siblings('.sub-side-nav').slideToggle(100); return false; } else if( this_is_current ) { //alert("current"); $(this).parent('li').toggleClass('current'); $(this).siblings('.sub-side-nav').slideToggle(100); } } */ } if( $(this).attr('href') == "/" ) { return false; } return true; }); $(".code-terminal").parent().next(".highlight-default").addClass("terminal"); // Doc responsive menu code var _w = $(window).width(); var searchContent = $('.nginx-doc-sidebar-inner .search-doc-wrapper').html(); $('.nginx-doc-sidebar').prepend('