Skip to content

Commit

Permalink
feature: show tooltip titles on touch screens
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed May 14, 2024
1 parent c2d2446 commit 46a7b1e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions flexmeasures/ui/static/css/flexmeasures.css
Original file line number Diff line number Diff line change
Expand Up @@ -1865,4 +1865,25 @@ div.heading-group {
.breadcrumb-item + .breadcrumb-item::before {
content: " > ";
color: var(--primary-color);
}

/* Show tooltip titles on touch screens */
[title] {
border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
border-radius:2px;
position: relative;
}
body.touched [title]:hover > * {
user-select: auto
}
body.touched [title]:hover:after {
position: absolute;
top: 100%;
right: -10%;
content: attr(title);
border: 1px solid rgba(0, 0, 0, 0.2);
background-color: white;
box-shadow: 1px 1px 3px;
padding: 0.3em;
z-index: 1;
}
7 changes: 7 additions & 0 deletions flexmeasures/ui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@
{#- Scripts used by all views (e.g. by navigation menu) -#}
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"></script>

<!-- Add the class touched to body when the user uses any touch event. -->
<script>
document.body.addEventListener('touchstart', function() {
document.body.classList.add('touched');
});
</script>

{% block scripts %}

<!-- External scripts -->
Expand Down

0 comments on commit 46a7b1e

Please sign in to comment.