How to disable js code on the mobile version?

Good day, there is a piece of code which works as expected, but at the mob. version need this code did not work, please tell me how and what do to when the screen resolution is less than 768, the code did not work.
the <script>
 var moveForce = 30; 
 var rotateForce = 20; 
 $(document).mousemove(function(e) {
 var docX = $(document).width();
 var docY = $(document).height();

 var moveX = (e.pageX - docX / 2) / (docX / 2) * -moveForce;
 var moveY = (e.pageY - docY / 2) / (docY / 2) * -moveForce;

 var rotateY = (e.pageX / docX * rotateForce * 2) - rotateForce;
 var rotateX = -((e.pageY / docY * rotateForce * 2) - rotateForce);

$('.popup')
 .css('left', moveX + 'px')
 .css('top', moveY + 'px')
 .css('transform', 'rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
});
 </script>


Have tried a lot on articles in Google - nothing works. probably something not so do ((
March 19th 20 at 09:18
2 answers
March 19th 20 at 09:20
(function() {
if(document.window.screen.availWidth < 768) {
moveForse = 'string';
}
});

In this case make the variable Global moveForse
There are also <code></code>
And even <code lang="javascript"></code> - lourdes.Will4 commented on March 19th 20 at 09:23
March 19th 20 at 09:22
(function() {
 function isMobile() {
 var MOBILE_SCREEN_WITH = 768;
 return $(window).width() <= MOBILE_SCREEN_WITH;
}

 if (isMobile()) {
return;
}

 var moveForce = 30;
 var rotateForce = 20;

 $(document).mousemove(function(e) {
 var docX = $(document).width();
 var docY = $(document).height();

 var moveX = (e.pageX - docX / 2) / (docX / 2) * -moveForce;
 var moveY = (e.pageY - docY / 2) / (docY / 2) * -moveForce;

 var rotateY = (e.pageX / docX * rotateForce * 2) - rotateForce;
 var rotateX = -((e.pageY / docY * rotateForce * 2) - rotateForce);

$('.popup')
 .css('left', moveX + 'px')
 .css('top', moveY + 'px')
 .css('transform', 'rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
});
})();

Find more questions by tags jQueryJavaScript