게이테스트/app.js
< 게이테스트
$("#bodyContent .ng-option-wrapper").off().eq(0).on('mousemove ontouchstart', function(e) {
let $this = $(this);
let parentOffset = $this.offset();
let relX = e.pageX - parentOffset.left;
let relY = e.pageY - parentOffset.top;
let moveX = (relX - $this.width() / 2) * -1;
let moveY = (relY - $this.height() / 2) * -1;
let interval = 150;
if(Math.abs(moveY) < Math.abs(moveX)){
moveX = moveX > 0 ? interval : (interval * -1)
} else {
moveY = moveY > 0 ? interval : (interval * -1)
}
$this.find(".fakelinks").css({
transform: 'translate(' + moveX + 'px, ' + moveY + 'px)'
});
})
.on('mouseleave ontouchend', function(e) {
$(this).find(".fakelinks").css({
transform: 'translate(0px, 0px)'
});
})