updated v2 test version
This commit is contained in:
parent
55f2cfbabe
commit
3f61615bd3
1 changed files with 27 additions and 17 deletions
|
@ -43,28 +43,38 @@
|
|||
|
||||
<script type="application/javascript">
|
||||
$(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 ww = $(window).width();
|
||||
var wh = $(window).height();
|
||||
var traX, traY, traX2, traY2;
|
||||
$(document).mousemove(function (e) {
|
||||
mouseX = e.pageX;
|
||||
mouseY = e.pageY;
|
||||
traX = (((50 * mouseX) / ww)) - 50;
|
||||
traY = (((50 * mouseY) / wh)) - 50;
|
||||
traX2 = (50 + traX) * -1;
|
||||
traY2 = (50 + traY) * -1;
|
||||
console.log(traX);
|
||||
$('#topper-image').css({
|
||||
"left": traX + "px",
|
||||
"top": traY + "px"
|
||||
});
|
||||
$('#top-image').css({
|
||||
"left": traX2 + "px",
|
||||
"top": traY2 + "px"
|
||||
});
|
||||
mouseX = event.pageX;
|
||||
mouseY = event.pageY;
|
||||
traX = (((50 * mouseX) / ww)) - 50;
|
||||
traY = (((50 * mouseY) / wh)) - 50;
|
||||
traX2 = (50 + traX) * -1;
|
||||
traY2 = (50 + traY) * -1;
|
||||
console.log(traX);
|
||||
$('#topper-image').css({
|
||||
"left": traX + "px",
|
||||
"top": traY + "px"
|
||||
});
|
||||
});
|
||||
$('#top-image').css({
|
||||
"left": traX2 + "px",
|
||||
"top": traY2 + "px"
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in a new issue