Update '12/index.html'

master
Max Lehmann 5 years ago
parent b31fd72550
commit aa484fd068

@ -265,7 +265,7 @@
</div><!-- <div class="contributors"> -->
<script src="player2.js"></script>
<script src="liveplayer.js"></script>
<script src="dragable.js"></script>
<!--script src="dragable.js"></script-->
<script>
player(document.querySelector("#week_04"), document.querySelector("#iframe_04"));
@ -299,6 +299,81 @@
document.querySelector(".audio_05 #resources_icon").addEventListener("click",function(){
document.querySelector("#implicancies_05 #resources_05").classList.toggle("hidden");
});
var dragItem = document.querySelector("#shell_03header");
var container = document.querySelector("#shell03");
var active = false;
var currentX;
var currentY;
var initialX;
var initialY;
var xOffset = 0;
var yOffset = 0;
container.addEventListener("touchstart", dragStart, false);
container.addEventListener("touchend", dragEnd, false);
container.addEventListener("touchmove", drag, false);
container.addEventListener("mousedown", dragStart, false);
container.addEventListener("mouseup", dragEnd, false);
container.addEventListener("mousemove", drag, false);
function dragStart(e) {
if (e.type === "touchstart") {
initialX = e.touches[0].clientX - xOffset;
initialY = e.touches[0].clientY - yOffset;
} else {
initialX = e.clientX - xOffset;
initialY = e.clientY - yOffset;
}
if (e.target === dragItem) {
active = true;
}
}
function dragEnd(e) {
initialX = currentX;
initialY = currentY;
active = false;
}
function drag(e) {
if (active) {
e.preventDefault();
if (e.type === "touchmove") {
currentX = e.touches[0].clientX - initialX;
currentY = e.touches[0].clientY - initialY;
} else {
currentX = e.clientX - initialX;
currentY = e.clientY - initialY;
}
xOffset = currentX;
yOffset = currentY;
setTranslate(currentX, currentY, dragItem);
}
}
function setTranslate(xPos, yPos, el) {
el.style.transform = "translate3d(" + xPos + "px, " + yPos + "px, 0)";
}
</script>

Loading…
Cancel
Save