mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed scroll offset when tabs are brought into view
This commit is contained in:
parent
35210f560f
commit
c4cb6b45a3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -216,7 +216,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.0f659f14.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.7f366e99.min.js' | url }}"></script>
|
||||||
{% for path in config["extra_javascript"] %}
|
{% for path in config["extra_javascript"] %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -140,10 +140,14 @@ export function mountContentTabs(
|
|||||||
|
|
||||||
/* Scroll container to active content tab */
|
/* Scroll container to active content tab */
|
||||||
const content = getElementContentOffset(container)
|
const content = getElementContentOffset(container)
|
||||||
if (offset.x < content.x)
|
if (
|
||||||
prev.click()
|
offset.x < content.x ||
|
||||||
else if (offset.x + width > content.x + size.width)
|
offset.x + width > content.x + size.width
|
||||||
next.click()
|
)
|
||||||
|
container.scrollTo({
|
||||||
|
left: Math.max(0, offset.x - 16),
|
||||||
|
behavior: "smooth"
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Handle complete */
|
/* Handle complete */
|
||||||
|
Loading…
Reference in New Issue
Block a user