jQuery Question

In jQuery, how to set the position of a element in percentage?

How to get the click event position in percentage and how to pass this value to element via
jQuery? When I pass via the

method, it pass always as pixels.

The events
return the values in pixels. I can calculate the percentage, but if there is some way to get in percentage, I will use it.

The main problem is passing the values as percentage to the element.


There's no pre-calculated percentage property.

    var percent = e.pageX / $(window).width() * 100;
    $(this).css('left',percent + '%');