While creating a mootools Slider-controled image gallery navigator (fancy huh?) at work, I suddenly had the need for getting the Total size (width in this case) of all the li elements inside a ul.
Continue reading “Elements.getTotalSize(), get the total size of an array of elements”
I’ve twisted my brain in all different angles today, trying to get my first custom Array property in mootools to work.
For some reason my code kept returning the content as an array, and not as an object like I’d set up my piece of code to do.
It turned out that there was allready a property with the name I selected for Elements, which Array then had inherited..
thus, it allready existed, returning an array of objects (the same object I was trying to return, actually..).
I ended up adding the property to Elements instead (for another reason), with a new Property name.
Lesson: before you try to add a new property to Array, Elements, or any Class in general, check if it allready exists :p