Skip to content

Commit

Permalink
Add shadow to version selector panel when left nav is scrolled (#6151) (
Browse files Browse the repository at this point in the history
#6168)

* Add shadow to version selector panel when scrolling



* Change shadow size



---------


(cherry picked from commit e7fc108)

Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 0f150d9 commit 9da4bfb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</a>
</div>
<nav role="navigation" aria-label="Main" id="site-nav" class="site-nav">
<div class="version-wrapper">
<div class="version-wrapper" id="version-panel">
{% if page.section == "opensearch" %}
<a href="{{site.url}}{{site.baseurl}}/about/" class="site-category">{{ page.section-name }}</a>
{% else %}
Expand Down
4 changes: 4 additions & 0 deletions _sass/custom/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ code {
margin-right: 0.5rem;
}

.nav-shadow {
box-shadow: 0 6px 4px -4px $grey-lt-300;
}

.main-content {
ol {
> li {
Expand Down
11 changes: 10 additions & 1 deletion assets/js/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const numCharsLabel = document.getElementById('num-chars');
const sendButton = document.getElementById('send');
const commentTextArea = document.getElementById('comment');
const thankYouText = document.getElementById('thank-you');

const nav = document.getElementById('site-nav');
const versionPanel = document.getElementById('version-panel');
document.addEventListener('DOMContentLoaded', updateTextArea);

document.addEventListener('click', function(event) {
Expand Down Expand Up @@ -32,6 +33,14 @@ document.addEventListener('click', function(event) {
}
});

nav.addEventListener('scroll',(e)=>{
if(nav.scrollTop > 0){
versionPanel.classList.add("nav-shadow");
}else{
versionPanel.classList.remove("nav-shadow");
}
});

commentTextArea.addEventListener('input', updateTextArea);

function updateTextArea() {
Expand Down

0 comments on commit 9da4bfb

Please sign in to comment.