Skip to content

Commit

Permalink
Style Popup on Top of Page
Browse files Browse the repository at this point in the history
Fix button to the left.
  • Loading branch information
ShaopengLin committed Sep 9, 2024
1 parent 81cd156 commit f7844f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
8 changes: 6 additions & 2 deletions resources/js/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ function setupTOC()
tocTitle.id = "kiwix-toc-title";
tocTitle.textContent = "Contents";
toc.prepend(tocTitle);
document.body.prepend(toc);
document.body.prepend(tocPopupButtonElem());

var tocDiv = document.createElement('div');
tocDiv.id = "kiwix-toc-div";
tocDiv.prepend(toc);
tocDiv.prepend(tocPopupButtonElem());
document.body.prepend(tocDiv);
}

setupTOC();
32 changes: 30 additions & 2 deletions resources/js/tocStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ style.innerHTML = `
all: initial;
display: block;
visibility: hidden;
position: relative;
max-height: 50%;
max-width: 50%;
max-height: 50vh;
max-width: 50vh;
width: max-content;
overflow-y: auto;
Expand All @@ -54,5 +55,32 @@ style.innerHTML = `
margin-left: auto;
margin-right: auto;
}
#kiwix-toc-button {
all: initial;
position: relative;
display: block;
background: white;
margin: 0px;
padding 0px;
outline: none;
border: 1px solid #ccc;
border-radius: 3px;
}
#kiwix-toc-button:hover {
border: 1px solid #3366CC;
background-color: #D9E9FF;
}
#kiwix-toc-div {
all: initial;
display: block;
font-size: 0px;
margin: 8px;
position: fixed;
top: 0px;
z-index: 1000;
}
`
document.head.appendChild(style);

0 comments on commit f7844f0

Please sign in to comment.