You were right. I was checking to early. Like in the W3C
Recommendation mentioned, I added a "DomNodeInserted" EventListener to
get the full width for the div container. Here's the result:

****
// event listener for all inserted nodes
var maxWidth = 0;
$('imageContainer').observe('DOMNodeInserted', function(event) {
    maxWidth += Event.element(event).getWidth();
}

for (var index = 0, len = image.length; index < len; index++) {
    // create div element
    var itemDiv = new Element('div', {
        'id' : 'item-' + index,
        'class' : 'item'
    });

    // create image element
    var itemImage = new Element('img');
    itemImage.observe('load', function() {
        itemDiv.style.minWidth = this.getWidth() + 'px';
    });
    itemImage.src = itemPath + image[index]['src'];
    itemImage.alt = image[index]['caption'];

    itemDiv.appendChild(itemImage);

    $('imageContainer').appendChild(itemDiv);
}
****

Thanks for the fast and kind support!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to