類:
var paper = new Raphael(0, 0, 500, 500);
createRect(100, 100, 100, 50);
function createRect(x, y, width, height) {
var boundrect = paper.rect(x - 30, y - 30, width + 60, height + 60).attr({
"fill": "pink",
"stroke": "none"
}).mouseover(function(event) {
topCtrl.show()
}).mouseout(function(event) {
topCtrl.hide()
})
,
rect = paper.rect(x, y, width, height).attr({
"fill": "white",
"stroke": "red"
}).mouseover(function(event) {
topCtrl.show();
topCtrl.attr({
"fill": "white"
})
}),
topCtrl = paper.circle(x + (width/2), y, 5).attr({
"fill": "red"
});
}
來源
2012-01-02 18:24:15
Joe
喜歡這個? http://jsfiddle.net/qZKHM/11/ – Joe 2012-01-02 18:08:47
這樣一個簡單的解決方案,謝謝。如果你在下面再次發佈答案,我可以接受你的答案。 – tomen 2012-01-02 18:20:14
太棒了,很高興幫助 – Joe 2012-01-02 18:24:38