Fixed disappearance of tabs for smaller font sizes

This commit is contained in:
squidfunk 2019-06-15 15:54:50 +02:00
parent bc46b87d6a
commit 9d1390f318
4 changed files with 10 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -193,7 +193,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/application.d5a09f94.js' | url }}"></script> <script src="{{ 'assets/javascripts/application.ffb616e8.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] != "" %}

View File

@ -32,6 +32,7 @@ export default class Toggle {
* @constructor * @constructor
* *
* @property {HTMLElement} el_ - Content container * @property {HTMLElement} el_ - Content container
* @property {number} height_ - Header height
* @property {number} offset_ - Toggle page-y offset * @property {number} offset_ - Toggle page-y offset
* @property {boolean} active_ - Tabs visibility * @property {boolean} active_ - Tabs visibility
* *
@ -45,7 +46,11 @@ export default class Toggle {
throw new ReferenceError throw new ReferenceError
this.el_ = ref this.el_ = ref
/* Initialize offset and state */ /* Obtain header */
const header = document.querySelector("[data-md-component=header]")
/* Initialize height and state */
this.height_ = header.offsetHeight
this.active_ = false this.active_ = false
} }
@ -54,7 +59,7 @@ export default class Toggle {
*/ */
update() { update() {
const active = window.pageYOffset >= const active = window.pageYOffset >=
this.el_.children[0].offsetTop + (5 - 48) // TODO: quick hack to enable same handling for hero this.el_.children[0].offsetTop + (5 - this.height_)
if (active !== this.active_) if (active !== this.active_)
this.el_.dataset.mdState = (this.active_ = active) ? "hidden" : "" this.el_.dataset.mdState = (this.active_ = active) ? "hidden" : ""
} }