mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed glitch in sidebar when collapsing items
This commit is contained in:
6
material/assets/javascripts/application.43ad2ac2.js
Normal file
6
material/assets/javascripts/application.43ad2ac2.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -190,7 +190,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/application.efe184c7.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/application.43ad2ac2.js' | url }}"></script>
|
||||||
{% if lang.t("search.language") != "en" %}
|
{% if lang.t("search.language") != "en" %}
|
||||||
{% set languages = lang.t("search.language").split(",") %}
|
{% set languages = lang.t("search.language").split(",") %}
|
||||||
{% if languages | length and languages[0] != "" %}
|
{% if languages | length and languages[0] != "" %}
|
||||||
|
|||||||
@@ -70,8 +70,14 @@ export default class Collapse {
|
|||||||
this.el_.style.display = "block"
|
this.el_.style.display = "block"
|
||||||
this.el_.style.overflow = ""
|
this.el_.style.overflow = ""
|
||||||
|
|
||||||
|
/* Hack: read value directly from input field */
|
||||||
|
const expanded = this.el_
|
||||||
|
.previousElementSibling
|
||||||
|
.previousElementSibling
|
||||||
|
.checked
|
||||||
|
|
||||||
/* Expanded, so collapse */
|
/* Expanded, so collapse */
|
||||||
if (current) {
|
if (expanded) {
|
||||||
this.el_.style.maxHeight = `${current}px`
|
this.el_.style.maxHeight = `${current}px`
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
this.el_.setAttribute("data-md-state", "animate")
|
this.el_.setAttribute("data-md-state", "animate")
|
||||||
@@ -106,9 +112,9 @@ export default class Collapse {
|
|||||||
target.style.maxHeight = ""
|
target.style.maxHeight = ""
|
||||||
|
|
||||||
/* Hidden links should not be focusable, so hide them when the navigation
|
/* Hidden links should not be focusable, so hide them when the navigation
|
||||||
is collapsed and set overflow so the outline is not cut off */
|
is collapsed and set overflow so the outline is not cut off */
|
||||||
target.style.display = current ? "none" : "block"
|
target.style.display = expanded ? "none" : "block"
|
||||||
target.style.overflow = current ? "hidden" : "visible"
|
target.style.overflow = expanded ? "hidden" : "visible"
|
||||||
|
|
||||||
/* Only fire once, so directly remove event listener */
|
/* Only fire once, so directly remove event listener */
|
||||||
target.removeEventListener("transitionend", end)
|
target.removeEventListener("transitionend", end)
|
||||||
|
|||||||
Reference in New Issue
Block a user