am 2b9846d9: am f0093857: fix a couple bugs in sidenav for samples. Previously, clicking a link still invoked the expand collapse behavior. Previously, collapsing a parent item did not also collapse its children.

* commit '2b9846d9d1c075068d192f75f73f44896c95b7db':
  fix a couple bugs in sidenav for samples. Previously, clicking a link still invoked the expand collapse behavior. Previously, collapsing a parent item did not also collapse its children.
This commit is contained in:
Scott Main 2013-08-22 16:28:13 -07:00 committed by Android Git Automerger
commit f1d5a3b117

View file

@ -449,13 +449,6 @@ false; // navigate across topic boundaries only in design docs
}
// Stop expand/collapse behavior when clicking on nav section links (since we're navigating away
// from the page)
$('.nav-section-header').find('a:eq(0)').click(function(evt) {
window.location.href = $(this).attr('href');
return false;
});
// Set up play-on-hover <video> tags.
$('video.play-on-hover').bind('click', function(){
$(this).get(0).load(); // in case the video isn't seekable
@ -564,9 +557,11 @@ function initExpandableNavItems(rootTag) {
$(rootTag + ' li.nav-section .nav-section-header').click(function() {
var section = $(this).closest('li.nav-section');
if (section.hasClass('expanded')) {
/* hide me */
section.children('ul').slideUp(250, function() {
/* hide me and descendants */
section.find('ul').slideUp(250, function() {
// remove 'expanded' class from my section and any children
section.closest('li').removeClass('expanded');
$('li.nav-section', section).removeClass('expanded');
resizeNav();
});
} else {
@ -582,6 +577,14 @@ function initExpandableNavItems(rootTag) {
});
}
});
// Stop expand/collapse behavior when clicking on nav section links
// (since we're navigating away from the page)
// This selector captures the first instance of <a>, but not those with "#" as the href.
$('.nav-section-header').find('a:eq(0)').not('a[href="#"]').click(function(evt) {
window.location.href = $(this).attr('href');
return false;
});
}
function highlightSidenav() {