Line 10: | Line 10: | ||
<head> | <head> | ||
<style type="text/css"> | <style type="text/css"> | ||
− | + | .parallax{ | |
+ | background-image: url("https://static.igem.org/mediawiki/2018/d/dd/T--Uppsala--TeamPictureLow.jpg"); | ||
+ | } | ||
</style> | </style> | ||
</head> | </head> | ||
<div class="body"> | <div class="body"> | ||
− | <div class="parallax"></div> | + | <div class="parallax" data-src="https://static.igem.org/mediawiki/2018/1/12/T--Uppsala--TeamPicture.jpg"></div> |
<div class="igem-icon"><a href="https://2018.igem.org/Main_Page"><img src="https://static.igem.org/mediawiki/2018/b/b0/T--Uppsala--graylogo.png"></a></div> | <div class="igem-icon"><a href="https://2018.igem.org/Main_Page"><img src="https://static.igem.org/mediawiki/2018/b/b0/T--Uppsala--graylogo.png"></a></div> | ||
Line 155: | Line 157: | ||
+ | <script> | ||
+ | (() => { | ||
+ | 'use strict'; | ||
+ | // Page is loaded | ||
+ | const objects = document.getElementsByClassName('team-page-banner'); | ||
+ | Array.from(objects).map((item) => { | ||
+ | // Start loading image | ||
+ | const img = new Image(); | ||
+ | img.src = item.dataset.src; | ||
+ | // Once image is loaded replace the src of the HTML element | ||
+ | img.onload = () => { | ||
+ | item.classList.remove('team-page-banner'); | ||
+ | return item.nodeName === 'IMG' ? | ||
+ | item.src = item.dataset.src : | ||
+ | item.style.backgroundImage = `url(${item.dataset.src})`; | ||
+ | }; | ||
+ | }); | ||
+ | })(); | ||
− | + | </script> | |
Revision as of 15:14, 14 October 2018