If the user clicks somewhere in the bar, can the indicator get that width. (Similar to a progress bar in a video)
$(function(){
$("#play").click(function() {
$("#indicador").animate({"width": "150px"}, 8400);
});
});
Here to try and play:http://jsfiddle.net/SwkaR/7/
You can get the coordinates where the user clicked from the
Eventobject passed as first parameter to theclickevent handler. You simply have to subtract the element offset relative to the page from$.offset()to get the position relative to the element.For example, here’s a forked fiddle which allows you to place the indicator by clicking anywhere in the bar.