Detect left or right 10% of the screen click

by ethanpil

JavaScript

$(document).click(function(e) { 
        var clickx= e.pageX;
        var totalx=$(document).width();
        ratio = (clickx/totalx); 
        if ( ratio <= .1 ) {
            //Left 10% of the screen
        }
        else if (ratio >= .9 ) {
           //Right 90% of the screen
        }
    });