(function($) { $(document).ready(function() { $( ".article-image" ).removeClass("colorbox"); if ($(window).width() >= 1024) { $("#cover").click(function() { $(".imagezoom").addClass("imagezoomshow"); }); $("#close").click(function() { event.stopPropagation(); $(".imagezoom").removeClass("superzoom"); $(".imagezoom").removeClass("imagezoomshow"); }); $(".imagezoom").click(function() { // $(".imagezoom").removeClass("imagezoomshow"); $(".imagezoom").toggleClass("superzoom"); }); $(document).on("mousemove scroll resize", function(getCurrentPos) { var xCord = getCurrentPos.pageX; var yCord = getCurrentPos.pageY - $(window).scrollTop(); // ignore scroll when getting mouse position var yPercent = (yCord / $(window).height()) * 100; var xPercent = (xCord / $(window).width()) * 100; // console.log( yPercent + "%" ); ...