2015-01-09 104 views
0

我是Arbor.js和js的新手。我有一個設置了節點和邊的頁面 - 底層節點是可點擊的,並在同一個窗口中打開鏈接。我想要鏈接在新窗口中打開。任何人都可以提供建議嗎?如何在新窗口中打開Arbor.js節點鏈接?

我相信相關的代碼如下:

moved:function(e){ 
     var pos = $(canvas).offset(); 
     _mouseP = arbor.Point(e.pageX-pos.left, e.pageY-pos.top) 
     nearest = sys.nearest(_mouseP); 

     if (!nearest.node) return false 

     if (nearest.node.data.shape!='dot'){ 
      selected = (nearest.distance < 80) ? nearest : null 
      if (selected){ 
      dom.addClass('linkable') 
      window.status = selected.node.data.link.replace(/^\//,"http://"+window.location.host+"/").replace(/^#/,'') 
      } 
      else{ 
      dom.removeClass('linkable') 
      window.status = '' 
      } 
     }else if ($.inArray(nearest.node.name, ['Library','Materials','Documentation','Literature']) >=0){ 
      if (nearest.node.name!=_section){ 
      _section = nearest.node.name 
      that.switchSection(_section) 
      } 
      dom.removeClass('linkable') 
      window.status = '' 
     } 

     return false 

我重點圍繞window.status但我不知道有足夠的瞭解這一點。

任何幫助將不勝感激,謝謝。

回答

0

我使用:

window.open(selected.node.data.link);

相關問題