2012-05-14 9 views
2

Raphael JS에서 뭔가 분명하지 않습니다. 나는 a) 배열을 통해 반복하고, b) 값에서 원을 그리며, c) 텍스트 오버레이를 만들고 d) Raphael에서 청취자를 설정합니다.Raphael JS - id로 요소 가져 오기, 해당 요소를 상단으로 이동

내가 고심하고있는 것은 청취자의 행동입니다. 구체적으로, id로 요소를 가져오고, 맨 위로 이동하는 것과 같은 작업을 수행합니다. JSFiddle http://jsfiddle.net/NPks2/3/

에서

소스 나는이 작업을 기대하지만, 그렇지 않습니다. 도울 수 있니?

this.toFront(); 

당신의 element.mouseover 기능에 :

// this happening while looping through an object 
var p = paper.circle(x_coord, y_coord, diameter) 
    .data("i", i) 
    .attr({"fill": "90-"+fillColorStart+":5-"+fillColorEnd+":95","fill-opacity": 0.5}) 
    .glow({color: "#4b4b4b", width: 7}) 

    paper.text(x_coord, y_coord, opportunityTitle) 
    .data("text_id", i+"text") 
    .attr({ "font-size": 16, "font-family": fontFamily, "fill":fontColor}); 

    paper.text(x_coord, title_y_coord, ideasCount) 
    .attr({ "font-size": 27, "font-family": fontFamily, "fill":fontColor}); 


// loop is over, listeners are waiting 
paper.forEach(function(element) { 
    element.mouseover(function() { 
      c = elem_id = this.data("i");  
     t = p.getById(elem_id"+text); 

     c.toFront(); 
     t.toFront(); 
    }); 
}); 
+0

톤 = P .getById (elem_id "+ text)'.는 오타입니까? –

답변

3

당신은 추가 할 필요가

내가 업데이트하여 fiddle :

은`에서 중복 따옴표가있는 것 같다