Refactored sidebar/container spacing for arbitrary height elements above content

This commit is contained in:
squidfunk 2017-01-26 14:20:40 +01:00
parent b09e334f3f
commit 2c3ae17131
6 changed files with 17 additions and 17 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block libs %} {% block libs %}
<script src="{{ base_url }}/assets/javascripts/modernizr-facb31f4a3.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr.js"></script>
{% endblock %} {% endblock %}
{% block fonts %} {% block fonts %}
{% if config.extra.font != "none" %} {% if config.extra.font != "none" %}
@ -45,7 +45,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-f3ab63f78a.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-5f7edede88.css">
{% if config.extra.palette %} {% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-02ce7adcc2.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-02ce7adcc2.palette.css">
{% endif %} {% endif %}
@ -124,7 +124,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-2afe21e0b2.js"></script> <script src="{{ base_url }}/assets/javascripts/application-62dc17fe98.js"></script>
<script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script> <script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>

View File

@ -46,7 +46,7 @@ export default class Position {
* Initialize sidebar state * Initialize sidebar state
*/ */
setup() { setup() {
this.offset_ = this.el_.offsetTop - this.parent_.offsetTop this.offset_ = this.el_.offsetTop - 56
this.update() this.update()
} }
@ -55,18 +55,18 @@ export default class Position {
* *
* The inner height of the window (= the visible area) is the maximum * The inner height of the window (= the visible area) is the maximum
* possible height for the stretching sidebar. This height must be deducted * possible height for the stretching sidebar. This height must be deducted
* by the top offset of the parent container, which accounts for the fixed * by the height of the fixed header (56px). Depending on the page y-offset,
* header, setting the baseline. Depending on the page y-offset, the top * the top offset of the sidebar must be taken into account, as well as the
* offset of the sidebar must be taken into account, as well as the case * case where the window is scrolled beyond the sidebar container.
* where the window is scrolled beyond the sidebar container.
*/ */
update() { update() {
const offset = window.pageYOffset const offset = window.pageYOffset
const visible = window.innerHeight const visible = window.innerHeight
/* Calculate bounds of sidebar container */ /* Set bounds of sidebar container - must be calculated on every run, as
the height of the content might change due to loading images etc. */
this.bounds_ = { this.bounds_ = {
top: this.parent_.offsetTop, top: 56,
bottom: this.parent_.offsetTop + this.parent_.offsetHeight bottom: this.parent_.offsetTop + this.parent_.offsetHeight
} }

View File

@ -93,6 +93,7 @@ hr {
display: table; display: table;
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-top: 5.6rem;
table-layout: fixed; table-layout: fixed;
} }
@ -103,7 +104,6 @@ hr {
// Top-spacing to account for header and some additional padding // Top-spacing to account for header and some additional padding
&__inner { &__inner {
margin-top: 5.6rem;
padding-top: 2.4rem + 0.6rem; padding-top: 2.4rem + 0.6rem;
overflow: auto; overflow: auto;