Merge pull request #6 from melf1/master

Added elevator.js to the weblog.
This commit is contained in:
m 2015-04-22 21:51:16 +02:00
commit 5786221526
5 changed files with 15 additions and 0 deletions

View File

@ -27,3 +27,17 @@ layout: default
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
<div class="elevator-button" style="text-align: center; margin: auto; cursor: pointer;">Back to Top</div>
<script src="js/elevator.min.js"></script>
<script>
// Elevator script: https://github.com/tholman/elevator.js
window.onload = function() {
var elevator = new Elevator({
element: document.querySelector('.elevator-button'),
mainAudio: '/media/elevator-music.mp3', // Music from http://www.bensound.com/
endAudio: '/media/ding.mp3', // Music from http://www.bensound.com/
duration: 20000 // milliseconds
});
}
</script>

1
js/elevator.min.js vendored Normal file
View File

@ -0,0 +1 @@
var Elevator=function(){"use strict";function n(n,e){for(var t in e)t in n||(n[t]=e[t]);return n}function e(n,e,t,u){return n/=u/2,1>n?t/2*n*n+e:(n--,-t/2*(n*(n-2)-1)+e)}function t(n){p||(p=n);var u=n-p,o=e(u,v,-v,A);window.scrollTo(0,o),A>u?s=requestAnimationFrame(t):i()}function u(){w||(w=!0,v=document.documentElement.scrollTop||m.scrollTop,f||(A=1.5*v),requestAnimationFrame(t),c&&c.play())}function o(){p=null,v=null,w=!1}function i(){o(),c&&(c.pause(),c.currentTime=0),d&&d.play()}function r(){w&&(cancelAnimationFrame(s),o(),c&&(c.pause(),c.currentTime=0),window.scrollTo(0,0))}function l(n){n.addEventListener("click",u,!1)}function a(n){m=document.body,n.element&&l(n.element),n.duration&&(f=!0,A=n.duration),n.mainAudio&&(c=new Audio(n.mainAudio),c.setAttribute("preload","true"),c.setAttribute("loop","true")),n.endAudio&&(d=new Audio(n.endAudio),d.setAttribute("preload","true")),window.addEventListener("blur",r,!1)}var c,d,m=null,s=null,A=null,f=!1,p=null,v=null,w=!1;return n(a,{elevate:u})}();

BIN
media/ding.mp3 Normal file

Binary file not shown.

Binary file not shown.

BIN
media/elevator-music.mp3 Executable file

Binary file not shown.