am 3829f621: am b1a6d644: am 1670cca5: Merge "make the sticky bar aware of search result visiblity. Fixes a bug that caused the sidenav to overlap search results." into klp-docs

* commit '3829f62188161fe7528e18de7bb226896611fee0':
  make the sticky bar aware of search result visiblity. Fixes a bug that caused the sidenav to overlap search results.
This commit is contained in:
Scott Main 2014-04-14 15:01:48 +00:00 committed by Android Git Automerger
commit 78f264f79b
2 changed files with 19 additions and 12 deletions

View file

@ -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");

View file

@ -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 ?>