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>
|
||||
{% endblock %}
|
||||
{% 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"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -140,10 +140,14 @@ export function mountContentTabs(
|
||||
|
||||
/* Scroll container to active content tab */
|
||||
const content = getElementContentOffset(container)
|
||||
if (offset.x < content.x)
|
||||
prev.click()
|
||||
else if (offset.x + width > content.x + size.width)
|
||||
next.click()
|
||||
if (
|
||||
offset.x < content.x ||
|
||||
offset.x + width > content.x + size.width
|
||||
)
|
||||
container.scrollTo({
|
||||
left: Math.max(0, offset.x - 16),
|
||||
behavior: "smooth"
|
||||
})
|
||||
},
|
||||
|
||||
/* Handle complete */
|
||||
|
Loading…
Reference in New Issue
Block a user