To start off I'll just say I've been using Raphael for 2 days now, so don't shoot me in the face for asking this question.
I have a Raphael created drop down rendered like so:
When I expand the window the bottom border is based upon <div>
width so it expands perfectly (the image below might be a little f'd up):
The dotted lines expand (like they should), the problem is how do I expand (redraw) the Raphael shape to match the given % ?
The drawing part:
for (var i = 0; i < holder.length; i++) {
var paper = Raphael(title[i], title.slice(i, i + 1).width(), title.slice(i, i + 1).height()); //create new paper instance based on holder height and width
paper.setViewBox(0, 0, title.slice(i, i + 1).width(), title.slice(i, i + 1).height());
var rect = paper.roundedRectangle(0, 0, title.slice(i, i + 1).width(), title.slice(i, i + 1).height(), 20, 20, 20, 20).attr({ //draw on paper rounded rectangle
fill: "#E6E7E8", //background color
stroke: "#ddd" //border color (technically shape color)
});
var t = paper.text((title.slice(i, i + 1).width() - (title.slice(i, i + 1).width() - 20)), (title.slice(i, i + 1).height() / 2), title_content.slice(i, i + 1).text()).attr({ //add text
"text-anchor": "start", //left-align
"font-size": 16,
"font-family": "Arial, Helvetica, sans-serif"
});
textWrap(t, title.slice(i, i + 1).width()); //wrap text
}
I currently have this for resizing, but it doesn't work. It does product an error in the status bar, but because I only have ie7 I can't pull up firebug and read the console. Where am I going wrong?
$(window).resize(function() {
var i = 0;
$(title).each(function() {
paper.setSize($(this).width(), $(this).height());
rect.SetSize($(this).width(), $(this).height());
redraw_element();
i++;
});
});
update - setting to 100% results in short rendering even though container is wider.
var paper = Raphael(title[i], title.slice(i, i + 1).width(), title.slice(i, i + 1).height()); //create new paper instance based on holder height and width
paper.setViewBox(0, 0, title.slice(i, i + 1).width(), title.slice(i, i + 1).height());
var rect = paper.roundedRectangle(0, 0, '100%', '100%', 20, 20, 20, 20).attr({ //draw on paper rounded rectangle
fill: "#E6E7E8", //background color
stroke: "#ddd", //border color (technically shape color)
width: '100%',
height: '100%'
});
renders