简体   繁体   English

如何在新窗口中打开Arbor.js节点链接?

[英]How to open Arbor.js node link in a new window?

I'm new to Arbor.js and js in general. 我是Arbor.js和js的新手。 I have a page set up with nodes and edges - bottom level nodes are clickable and open links in the same window. 我在页面上设置了节点和边缘-底层节点是可单击的,并且在同一窗口中打开链接。 I'd like links to open in new windows. 我想要在新窗口中打开链接。 Could anyone offer any advice? 有人可以提供任何建议吗?

I believe the relevant code is as follows: 我相信相关代码如下:

 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

I'm focusing around window.status but I don't know enough about this. 我关注的是window.status,但我对此并不了解。

Any help will be much appreciated, thanks. 任何帮助将不胜感激,谢谢。

我正在使用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM