Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1670cca5 authored by Scott Main's avatar Scott Main Committed by Android (Google) Code Review
Browse files

Merge "make the sticky bar aware of search result visiblity. Fixes a bug that...

Merge "make the sticky bar aware of search result visiblity. Fixes a bug that caused the sidenav to overlap search results." into klp-docs
parents 318fb971 d6a8e662
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -880,16 +880,21 @@ function writeCookie(cookie, val, section, expiration) {



var stickyTop;
/* Sets the vertical scoll position at which the sticky bar should appear.
   This method is called to reset the position when search results appear or hide */
function setStickyTop() {
  stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
}


/* 
 * Displays sticky nav bar on pages when dac header scrolls out of view 
 */
var stickyTop;
(function() {
  $(document).ready(function() {

    // Sticky nav position
    stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
    setStickyTop();
    var sticky = false;
    var hiding = false;
    var $stickyEl = $('#sticky-header');
@@ -2368,13 +2373,13 @@ function submit_search() {
  var query = document.getElementById('search_autocomplete').value;
  location.hash = 'q=' + query;
  loadSearchResults();
  $("#searchResults").slideDown('slow');
  $("#searchResults").slideDown('slow', setStickyTop);
  return false;
}


function hideResults() {
  $("#searchResults").slideUp();
  $("#searchResults").slideUp('fast', setStickyTop);
  $(".search .close").addClass("hide");
  location.hash = '';

@@ -2491,7 +2496,7 @@ google.setOnLoadCallback(function(){
    return;
  } else {
    // first time loading search results for this page
    $('#searchResults').slideDown('slow');
    $('#searchResults').slideDown('slow', setStickyTop);
    $(".search .close").removeClass("hide");
    loadSearchResults();
  }
@@ -2511,7 +2516,7 @@ $(window).hashchange( function(){
  // Otherwise, we have a search to do
  var query = decodeURI(getQuery(location.hash));
  searchControl.execute(query);
  $('#searchResults').slideDown('slow');
  $('#searchResults').slideDown('slow', setStickyTop);
  $("#search_autocomplete").focus();
  $(".search .close").removeClass("hide");

+7 −5
Original line number Diff line number Diff line
@@ -293,6 +293,13 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
    </div>

  <?cs /if ?>


  <div id="searchResults" class="wrap" style="display:none;">
    <h2 id="searchTitle">Results</h2>
    <div id="leftSearchControl" class="search-control">Loading...</div>
  </div>

</div> <!--end headerwrap -->

<div id="sticky-header">
@@ -307,10 +314,5 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
  </div>
</div>

<div id="searchResults" class="wrap" style="display:none;">
  <h2 id="searchTitle">Results</h2>
  <div id="leftSearchControl" class="search-control">Loading...</div>
</div>

<?cs /if ?><?cs # end if/else !devsite ?><?cs
/def ?>