Mercurial Hosting > disearch
diff src/site.js @ 9:88f425d261b3
add menu
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 25 Oct 2023 18:38:07 -0600 |
parents | 8896ffd7b152 |
children | 62dd23f0b549 |
line wrap: on
line diff
--- a/src/site.js Tue Oct 24 19:31:33 2023 -0600 +++ b/src/site.js Wed Oct 25 18:38:07 2023 -0600 @@ -43,6 +43,28 @@ ajax( '/error_log.js', 'err='+encodeURIComponent(err) ); }; +let currentPulldown = null; +let newPulldown = null; + +function clickMenu(clicked,display) { + //console.log("clickMenu"); + let pulldown = clicked.parentNode.querySelector('[pulldown_menu]'); + if( pulldown !== currentPulldown ) { + pulldown.style.display = display || "block"; + newPulldown = pulldown; + window.onclick = function() { + if( currentPulldown ) { + currentPulldown.style.display = "none"; + if( !newPulldown ) + window.onclick = null; + } + currentPulldown = newPulldown; + newPulldown = null; + }; + pulldown.scrollIntoViewIfNeeded(false); + } +} + function logout() { document.cookie = 'user=; Max-Age=0; path=/;'; location = '/';