Hello,

I don't know what you think about border radius right now, but as it is not
totally cross plataform yet, I managed to create a function to set it almost
cross plataform, BUT, not in IE htc file hell stuff.

(function() {
    var borderRadius = {
        _all:        $w("borderRadius MozBorderRadius webkitBorderRadius"),
        topLeft:     $w("borderTopLeftRadius MozBorderRadiusTopleft
webkitBorderTopLeftRadius"),
        bottomLeft:  $w("borderBottomLeftRadius MozBorderRadiusBottomleft
webkitBorderBottomLeftRadius"),
        topRight:    $w("borderTopRightRadius MozBorderRadiusTopright
webkitBorderTopRightRadius"),
        bottomRight: $w("borderBottomRightRadius MozBorderRadiusBottomright
webkitBorderBottomRightRadius")
    };

    function setBorderRadius(element, borders) {
        var realBorders = {};
            if(Object.isString(borders)) {
                borders = {_all:borders};
            }
            for(var border in borders) {
                borderRadius[border].each(function(borderTranslate){
                    realBorders[borderTranslate] = borders[border];
                });
            }
            element.setStyle(realBorders);

            return element;
    }

    Element.addMethods({
        setBorderRadius: setBorderRadius
    });
})();

It accepts arguments like:

$("id_element").setBorderRadius("30px");
$("id_element").setBorderRadius({topLeft:"30px", bottomRight:"30px"});

In fact I may not be aware of how to deal with rounded borders for the
present state, but this function just helped me a little so it may help some
of you.

Cheers
Rafael

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en

Reply via email to