jQuery: width() in Prozent

closeThis post was published more than three months ago. Please note that the information offered here may no longer be current and valid. Therefore, please inform yourself about this topic elsewhere. If there is any new information, you can also send me a comment. Thank you so much!

Falls jemand mal die Breite eines HTML-Elements auslesen möchte und diese Wert jedoch in Prozent umgerechnet haben möchte – so geht es!

$(selector).width() / $(selector).parent().width() * 100;

Links:
http://api.jquery.com/width/

Published by

voku

Lars Moelleken | Ich bin root, ich darf das!