![]() |
Prototype: get all childElements with <img> & combine their height for 1 value
I don't really know where to start even in theory, but I know there is a way. Could someone point me into the right direction?
|
$$('img') would pull all img tags
http://www.prototypejs.org/api/utility/dollar-dollar suffix it with an each statement to walk through and get all the values: http://www.prototypejs.org/api/array/each and use getHeight to get the height and add them up... http://www.prototypejs.org/api/element/getheight Code:
function(){ |
Wow, thanks so much. Your code worked right out of the box. But i modified it a little for an each function inside a specific div containing imgs and to include the offset width of the imgs.
also eval threw an error, although it got the heights, so I just used s as the variable. Heres what my code if anyone was wandering... Code:
total=0; |
| All times are GMT +1. The time now is 11:20 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.