updated v2 test version

This commit is contained in:
Samuel Philipp 2018-10-03 22:27:22 +02:00
parent 55f2cfbabe
commit 3f61615bd3

View file

@ -43,28 +43,38 @@
<script type="application/javascript"> <script type="application/javascript">
$(document).ready(function () { $(document).ready(function () {
document.addEventListener('touchmove', function (event) {
event.preventDefault();
var e = event.touches[0];
move(e);
});
document.addEventListener('mousemove', function (event) {
event.preventDefault();
move(event);
});
});
function move(event) {
var mouseX, mouseY; var mouseX, mouseY;
var ww = $(window).width(); var ww = $(window).width();
var wh = $(window).height(); var wh = $(window).height();
var traX, traY, traX2, traY2; var traX, traY, traX2, traY2;
$(document).mousemove(function (e) { mouseX = event.pageX;
mouseX = e.pageX; mouseY = event.pageY;
mouseY = e.pageY; traX = (((50 * mouseX) / ww)) - 50;
traX = (((50 * mouseX) / ww)) - 50; traY = (((50 * mouseY) / wh)) - 50;
traY = (((50 * mouseY) / wh)) - 50; traX2 = (50 + traX) * -1;
traX2 = (50 + traX) * -1; traY2 = (50 + traY) * -1;
traY2 = (50 + traY) * -1; console.log(traX);
console.log(traX); $('#topper-image').css({
$('#topper-image').css({ "left": traX + "px",
"left": traX + "px", "top": traY + "px"
"top": traY + "px"
});
$('#top-image').css({
"left": traX2 + "px",
"top": traY2 + "px"
});
}); });
}); $('#top-image').css({
"left": traX2 + "px",
"top": traY2 + "px"
});
}
</script> </script>
</head> </head>
<body> <body>