jquery,approach,event,close,getting

Kubilay 11/20/2017 0

This code block runs when specified is approached

JavaScript
var approachDistance = 100;
$(document).on("mousemove", function (event) {
    var mouseX = event.pageX;
    var mouseY = event.pageY;

    $(".js-read-more").each(function () {
        var dataId = $(this).attr("data-id");
        var offset = $(this).offset();
        
        var absX = Math.abs(mouseX - offset.left);
        var absY = Math.abs(mouseY - offset.top);
        
        if (absX < approachDistance && absY < (approachDistance/2)) {
            //$(this).trigger("click");
        }

    });
}); 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments