For example: my div’s width is 100% and I want to click this div, when I click in 40% or 60% I need detect this number, where is mouse location and count this width :)))
Could you just put another div inside at the size you need and assign a click event?
Here’s a pen that might help :: http://codepen.io/Boogiesox/pen/BrCeD it gets coords relative to a targeted element (perhaps your 40% or 60% element if possible).
Otherwise, please provide an example or try and explain more thoroughly. Thanks!
We don’t know what he intends to do once the width is calculated so I’m not sure how an extra element (which may or may not be there in the first place).
As a rule of thumb, my first question to the OP is..
**”What are you trying to do and why?”**
Quite often they are trying to go about something completely the wrong way. This may not be true in this case but without further information it’s hard to offer advice.
@Paulie_D I needed this http://codepen.io/Boogiesox/pen/BrCeD
So this is solved?
I get that the Codepen gives you the information, my question is “now what are you going to do with it?”.
@Paulie_D Yes, this is solved. I wanted this for a make custom range input, with value and steps . . .
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".