make the sticky bar aware of search result visiblity.
Fixes a bug that caused the sidenav to overlap search results. Change-Id: I3dc431f46cd96164dd79f3d0461f5034cc912099
This commit is contained in:
parent
20cf2a91f0
commit
d6a8e662cf
|
@ -877,16 +877,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');
|
||||
|
@ -2365,13 +2370,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 = '';
|
||||
|
||||
|
@ -2488,7 +2493,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();
|
||||
}
|
||||
|
@ -2508,7 +2513,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");
|
||||
|
||||
|
|
|
@ -292,6 +292,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">
|
||||
|
@ -306,10 +313,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 ?>
|
||||
|
|
Loading…
Reference in New Issue