Edit iframe loading animations
This commit is contained in:
parent
e0cb8d46f4
commit
39466006da
8 changed files with 121 additions and 95 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,10 @@ body {
|
||||||
font-size: var(--text-font-size);
|
font-size: var(--text-font-size);
|
||||||
line-height: var(--text-line-height);
|
line-height: var(--text-line-height);
|
||||||
color: var(--black);
|
color: var(--black);
|
||||||
|
background-color: var(--feldgrau);
|
||||||
|
}
|
||||||
|
|
||||||
|
.body--white-background {
|
||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +137,7 @@ body {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
background-color: var(--white);
|
background-color: transparent;
|
||||||
transition: background-color 400ms ease-in-out;
|
transition: background-color 400ms ease-in-out;
|
||||||
|
|
||||||
.sidebar__nav {
|
.sidebar__nav {
|
||||||
|
@ -185,7 +189,6 @@ body {
|
||||||
|
|
||||||
&--slimmed {
|
&--slimmed {
|
||||||
width: 15%;
|
width: 15%;
|
||||||
background-color: transparent;
|
|
||||||
|
|
||||||
.sidebar__nav-link {
|
.sidebar__nav-link {
|
||||||
color: var(--transparent-black);
|
color: var(--transparent-black);
|
||||||
|
@ -197,7 +200,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--transparent-white);
|
background-color: var(--transparent-feldgrau);
|
||||||
|
|
||||||
|
|
||||||
.sidebar__nav-link {
|
.sidebar__nav-link {
|
||||||
|
@ -209,7 +212,13 @@ body {
|
||||||
fill: var(--black);
|
fill: var(--black);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--white-background {
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--transparent-white);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +237,7 @@ body {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0 0 0 15%;
|
// padding: 0 0 0 15%;
|
||||||
transition: opacity 400ms ease-in-out;
|
transition: opacity 400ms ease-in-out;
|
||||||
|
|
||||||
&--visible {
|
&--visible {
|
||||||
|
|
|
@ -11,21 +11,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotate-vertical-left {
|
|
||||||
0% {
|
|
||||||
transform: rotateY(0);
|
|
||||||
transform-origin: left;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: rotateY(180deg);
|
|
||||||
transform-origin: left;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: rotateY(0);
|
|
||||||
transform-origin: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rotate-horizontal-bottom {
|
@keyframes rotate-horizontal-bottom {
|
||||||
0% {
|
0% {
|
||||||
transform: rotateX(0);
|
transform: rotateX(0);
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
--white: #fff;
|
--white: #fff;
|
||||||
--transparent-white: rgba(255, 255, 255, 0.9);
|
--transparent-white: rgba(255, 255, 255, 0.9);
|
||||||
--feldgrau: #4B6259;
|
--feldgrau: #4B6259;
|
||||||
|
--transparent-feldgrau: rgba(75, 98, 89, 0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Media queries
|
// Media queries
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
// DATA
|
// DATA
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// SIDEBAR ANIMATION
|
// IFRAME LOADING ANIMATIONS
|
||||||
|
|
||||||
|
const body = document.querySelector('body');
|
||||||
const sidebar = document.querySelector('.sidebar');
|
const sidebar = document.querySelector('.sidebar');
|
||||||
const sidebarNavLinks = document.querySelectorAll('.sidebar__nav-link--internal');
|
const sidebarNavLinks = document.querySelectorAll('.sidebar__nav-link--internal');
|
||||||
const logoIcon = document.querySelector('.logo__icon');
|
const logoIcon = document.querySelector('.logo__icon');
|
||||||
|
@ -26,7 +27,19 @@ function convertRemToPixels(rem) {
|
||||||
return rem * fontSize;
|
return rem * fontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SIDEBAR ANIMATION
|
// IFRAME LOADING ANIMATIONS
|
||||||
|
|
||||||
|
function enableLogoIconRotation() {
|
||||||
|
if (logoIcon) {
|
||||||
|
logoIcon.classList.add('logo__icon--rotate-horizontal-bottom');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableLogoIconRotation() {
|
||||||
|
if (logoIcon) {
|
||||||
|
logoIcon.classList.remove('logo__icon--rotate-horizontal-bottom');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function slimDownSidebar() {
|
function slimDownSidebar() {
|
||||||
if (sidebar && !sidebar.classList.contains('sidebar--slimmed')) {
|
if (sidebar && !sidebar.classList.contains('sidebar--slimmed')) {
|
||||||
|
@ -34,23 +47,26 @@ function slimDownSidebar() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enableExhibitionIframeVisibility() {
|
||||||
function enableLogoIconRotation() {
|
if (exhibitionIframe) {
|
||||||
if (logoIcon) {
|
exhibitionIframe.classList.add('exhibition--visible');
|
||||||
if (logoIcon.classList.contains('logo__icon--vertical')) {
|
|
||||||
logoIcon.classList.add('logo__icon--rotate-vertical-left');
|
|
||||||
} else {
|
|
||||||
logoIcon.classList.add('logo__icon--rotate-horizontal-bottom');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableLogoIconRotation() {
|
function disableExhibitionIframeVisibility() {
|
||||||
if (logoIcon) {
|
if (exhibitionIframe) {
|
||||||
if (logoIcon.classList.contains('logo__icon--vertical')) {
|
exhibitionIframe.classList.remove('exhibition--visible');
|
||||||
logoIcon.classList.remove('logo__icon--rotate-vertical-left');
|
}
|
||||||
} else {
|
}
|
||||||
logoIcon.classList.remove('logo__icon--rotate-horizontal-bottom');
|
|
||||||
|
function editBackgroundColor(sidebarNavLink) {
|
||||||
|
if (body && sidebar) {
|
||||||
|
if (sidebarNavLink.getAttribute('data-background') === 'feldgrau') {
|
||||||
|
body.classList.remove('body--white-background');
|
||||||
|
sidebar.classList.remove('sidebar--white-background');
|
||||||
|
} else if (sidebarNavLink.getAttribute('data-background') === 'white') {
|
||||||
|
body.classList.add('body--white-background');
|
||||||
|
sidebar.classList.add('sidebar--white-background');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,12 +75,14 @@ function loadExhibitionIframe() {
|
||||||
if (sidebarNavLinks.length > 0 && exhibitionIframe) {
|
if (sidebarNavLinks.length > 0 && exhibitionIframe) {
|
||||||
for (let i = 0; i < sidebarNavLinks.length; i++) {
|
for (let i = 0; i < sidebarNavLinks.length; i++) {
|
||||||
sidebarNavLinks[i].addEventListener('click', function(e) {
|
sidebarNavLinks[i].addEventListener('click', function(e) {
|
||||||
|
logoIcon.removeEventListener('animationiteration', disableLogoIconRotation);
|
||||||
enableLogoIconRotation();
|
enableLogoIconRotation();
|
||||||
exhibitionIframe.classList.remove('exhibition--visible');
|
disableExhibitionIframeVisibility();
|
||||||
exhibitionIframe.addEventListener('load', function(e) {
|
exhibitionIframe.addEventListener('load', function(e) {
|
||||||
|
logoIcon.addEventListener('animationiteration', disableLogoIconRotation);
|
||||||
slimDownSidebar();
|
slimDownSidebar();
|
||||||
disableLogoIconRotation();
|
enableExhibitionIframeVisibility();
|
||||||
exhibitionIframe.classList.add('exhibition--visible');
|
editBackgroundColor(sidebarNavLinks[i]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -79,6 +97,6 @@ function loadExhibitionIframe() {
|
||||||
|
|
||||||
enableActivePseudoClass();
|
enableActivePseudoClass();
|
||||||
|
|
||||||
// SIDEBAR ANIMATION
|
// IFRAME LOADING ANIMATIONS
|
||||||
|
|
||||||
loadExhibitionIframe();
|
loadExhibitionIframe();
|
||||||
|
|
|
@ -17,7 +17,7 @@ fields:
|
||||||
en: URL
|
en: URL
|
||||||
fr: URL
|
fr: URL
|
||||||
type: url
|
type: url
|
||||||
width: 3/4
|
width: 2/4
|
||||||
external_link:
|
external_link:
|
||||||
label:
|
label:
|
||||||
en: External link
|
en: External link
|
||||||
|
@ -31,11 +31,27 @@ fields:
|
||||||
en: 'Yes'
|
en: 'Yes'
|
||||||
fr: Oui
|
fr: Oui
|
||||||
width: 1/4
|
width: 1/4
|
||||||
|
background_color:
|
||||||
|
when:
|
||||||
|
external_link: false
|
||||||
|
label:
|
||||||
|
en: Background color
|
||||||
|
fr: Couleur de fond
|
||||||
|
type: select
|
||||||
|
options:
|
||||||
|
feldgrau: Feldgrau
|
||||||
|
white:
|
||||||
|
en: White
|
||||||
|
fr: Blanc
|
||||||
|
default: feldgrau
|
||||||
|
width: 1/4
|
||||||
columns:
|
columns:
|
||||||
url:
|
url:
|
||||||
width: 3/4
|
width: 2/4
|
||||||
external_link:
|
external_link:
|
||||||
width: 1/4
|
width: 1/4
|
||||||
|
background_color:
|
||||||
|
width: 1/4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
{% for exhibition in exhibitions %}
|
{% for exhibition in exhibitions %}
|
||||||
<li class="sidebar__nav-item">
|
<li class="sidebar__nav-item">
|
||||||
{% if exhibition.external_link == 'false' %}
|
{% if exhibition.external_link == 'false' %}
|
||||||
<a class="sidebar__nav-link sidebar__nav-link--internal" href="{{ exhibition.url }}" target="exhibition">{{ exhibition.title }}</a>
|
<a class="sidebar__nav-link sidebar__nav-link--internal" href="{{ exhibition.url }}" target="exhibition" data-background="{{ exhibition.background_color }}">{{ exhibition.title }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="sidebar__nav-link sidebar__nav-link--external" href="{{ exhibition.url }}" target="_blank">{{ exhibition.title }}</a>
|
<a class="sidebar__nav-link sidebar__nav-link--external" href="{{ exhibition.url }}" target="_blank">{{ exhibition.title }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue