我很抱歉提出這個問題,但我只是在今天上午尋找一些指導。我只是想創建一個函數,這樣我就可以通過傳入該元素來使Raphael元素髮光。以下是我的代碼。爲什麼這不起作用?javascript raphael對象函數傳遞
var paper = Raphael("playarea", 500, 500);
var rectangle = paper.rect(100, 100, 200, 200, 4);
function elemHover(var el)
{
el.hover(
// When the mouse comes over the object //
// Stock the created "glow" object in myCircle.g
function() {
this.g = this.glow({
color: "#0000EE",
width: 10,
opacity: 0.8
});
},
// When the mouse goes away //
// this.g was already created. Destroy it!
function() {
this.g.remove();
});
}
elemHover(rectangle);
這裏是小提琴http://jsfiddle.net/aZG6C/15/
你看到在你的JS控制檯任何錯誤? – apsillers 2012-07-31 13:58:12
你能提供一個jsfiddle演示嗎? – 2012-07-31 14:00:17
這裏是小提琴http://jsfiddle.net/aZG6C/15/ – j0hnstew 2012-07-31 15:06:24