Skip to content

Tooltip added for sidemenu subitems #1179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/core/render/tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ export function tree(toc, tpl = '<ul class="app-sub-sidebar">{inner}</ul>') {

let innerHTML = '';
toc.forEach(node => {
innerHTML += `<li><a class="section-link" href="${node.slug}">${node.title}</a></li>`;
innerHTML += `<li>
<div class="tooltip">
<span class="tooltiptext">${node.title}</span>
<a class="section-link" href="${node.slug}">${node.title}</a>
</div>
</li>`;
if (node.children) {
innerHTML += tree(node.children, tpl);
}
Expand Down
34 changes: 34 additions & 0 deletions src/themes/basic/_layout.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,40 @@ body:not(.ready)
[data-cloak], .app-nav, > nav
display none

.tooltip {
position: relative;
}

.tooltip .tooltiptext {
visibility: hidden;
opacity: 0;
transition: visibility 0.3s linear 1s, opacity 0.3s linear 1s;
-webkit-transition: visibility 0.3s linear 1s, opacity 0.3s linear 1s;
-o-transition: visibility 0.3s linear 1s, opacity 0.3s linear 1s;
-moz-transition: visibility 0.3s linear 1s, opacity 0.3s linear 1s;
visibility: hidden;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 5px;
position: absolute;
z-index: 21;
bottom: 100%;
left: 50%;
margin-left: -105px;
}

.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}

.tooltip .tooltiptext:hover {
visibility: hidden;
}


div#app
font-size 30px
font-weight lighter
Expand Down
4 changes: 4 additions & 0 deletions src/themes/vue.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ $sidebar-width = 300px
body
background-color $color-bg

.tooltip .tooltiptext {
margin-left: -120px;
}

/* sidebar */
.sidebar
background-color $color-bg
Expand Down