Skip to content
Snippets Groups Projects
Commit a3daeb0c authored by Lukas Schauer's avatar Lukas Schauer :unlock:
Browse files

added elevator music

parent bc0b2784
No related branches found
No related tags found
No related merge requests found
......@@ -11,29 +11,33 @@
<li>Raum A020</li>
</ul>
</div>
<div class="footer-col footer-col-2">
<p class="text">{{ site.coolquote }}</p>
</div>
<div class="footer-col footer-col-2">
{% comment %}
<ul class="social-media-list">
<li>
<a href="/wiki/">
Wiki
</a>
</li>
<li>
<a href="/projects/">
Projekte
</a>
</li>
</ul>
{% endcomment %}
<div class="footer-col footer-col-3">
<div class="elevator">
<svg class="sweet-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve" height="100px" width="100px">
<path d="M70,47.5H30c-1.4,0-2.5,1.1-2.5,2.5v40c0,1.4,1.1,2.5,2.5,2.5h40c1.4,0,2.5-1.1,2.5-2.5V50C72.5,48.6,71.4,47.5,70,47.5z M47.5,87.5h-5v-25h5V87.5z M57.5,87.5h-5v-25h5V87.5z M67.5,87.5h-5V60c0-1.4-1.1-2.5-2.5-2.5H40c-1.4,0-2.5,1.1-2.5,2.5v27.5h-5 v-35h35V87.5z"/>
<path d="M50,42.5c1.4,0,2.5-1.1,2.5-2.5V16l5.7,5.7c0.5,0.5,1.1,0.7,1.8,0.7s1.3-0.2,1.8-0.7c1-1,1-2.6,0-3.5l-10-10 c-1-1-2.6-1-3.5,0l-10,10c-1,1-1,2.6,0,3.5c1,1,2.6,1,3.5,0l5.7-5.7v24C47.5,41.4,48.6,42.5,50,42.5z"/>
</svg>
</div>
</div>
<div class="footer-col footer-col-3">
<p class="text">{{ site.coolquote }}</p>
</div>
</div>
</div>
</footer>
<script>
// Simple elevator usage.
var elementButton = document.querySelector('.elevator');
var elevator = new Elevator({
element: elementButton,
mainAudio: '/music/elevator.mp3', // Music from http://www.bensound.com/
endAudio: '/music/ding.mp3',
duration: 5000
});
</script>
......@@ -13,4 +13,5 @@
<link href="/css/font-awesome.min.css" rel="stylesheet">
<script src="/js/jquery.min.js"></script>
<script src="/js/elevator.min.js"></script>
</head>
......@@ -65,3 +65,22 @@ h5:hover .header-link,
h6:hover .header-link {
opacity: 1;
}
.elevator {
text-align: center;
cursor: pointer;
width: 140px;
margin: auto;
}
.elevator:hover {
opacity: 0.7;
}
.elevator svg {
width: 40px;
height: 40px;
display: block;
margin: auto;
margin-bottom: 5px;
}
......@@ -62,18 +62,18 @@
}
.footer-col-1 {
width: -webkit-calc(35% - (#{$spacing-unit} / 2));
width: calc(35% - (#{$spacing-unit} / 2));
width: -webkit-calc(30% - (#{$spacing-unit} / 2));
width: calc(30% - (#{$spacing-unit} / 2));
}
.footer-col-2 {
width: -webkit-calc(20% - (#{$spacing-unit} / 2));
width: calc(20% - (#{$spacing-unit} / 2));
width: -webkit-calc(60% - (#{$spacing-unit} / 2));
width: calc(60% - (#{$spacing-unit} / 2));
}
.footer-col-3 {
width: -webkit-calc(45% - (#{$spacing-unit} / 2));
width: calc(45% - (#{$spacing-unit} / 2));
width: -webkit-calc(10% - (#{$spacing-unit} / 2));
width: calc(10% - (#{$spacing-unit} / 2));
}
@include media-query($on-laptop) {
......
var Elevator=function(n){"use strict";function e(n,e,o,t){return n/=t/2,1>n?o/2*n*n+e:(n--,-o/2*(n*(n-2)-1)+e)}function o(n,e){for(var o in e){var t=void 0===n[o]&&"function"!=typeof o;t&&(n[o]=e[o])}return n}function t(n){for(var e=0;n;)e+=n.offsetTop||0,n=n.offsetParent;return e}function i(n){w||(w=n);var o=n-w,t=e(o,E,T-E,p);window.scrollTo(0,t),p>o?A=requestAnimationFrame(i):l()}function u(){return window.requestAnimationFrame&&window.Audio&&window.addEventListener}function r(){w=null,E=null,b=!1}function l(){r(),m&&(m.pause(),m.currentTime=0),s&&s.play()}function d(){b&&(cancelAnimationFrame(A),r(),m&&(m.pause(),m.currentTime=0),window.scrollTo(0,T))}function a(n){n.addEventListener?n.addEventListener("click",y.elevate,!1):n.attachEvent("onclick",function(){document.documentElement.scrollTop=T,document.body.scrollTop=T,window.scroll(0,T)})}function c(n){f=document.body;var e={duration:void 0,mainAudio:!1,endAudio:!1,preloadAudio:!0,loopAudio:!0};n=o(n,e),n.element&&a(n.element),u()&&(n.duration&&(v=!0,p=n.duration),n.targetElement&&(T=t(n.targetElement)),window.addEventListener("blur",d,!1),n.mainAudio&&(m=new Audio(n.mainAudio),m.setAttribute("preload",n.preloadAudio),m.setAttribute("loop",n.loopAudio)),n.endAudio&&(s=new Audio(n.endAudio),s.setAttribute("preload","true")))}var m,s,f=null,A=null,p=null,v=!1,w=null,E=null,T=0,b=!1,y=this;this.elevate=function(){b||(b=!0,E=document.documentElement.scrollTop||f.scrollTop,v||(p=1.5*E),requestAnimationFrame(i),m&&m.play())},c(n)};
\ No newline at end of file
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment