链接不工作在js-mindmap上 [英] Links not working on js-mindmap

查看:107
本文介绍了链接不工作在js-mindmap上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现了这个js用于创建思维导图,唯一不起作用的就是链接。我链接到github,因为这将是太多的代码放置在这里: https:// github。 com / kennethkufluk / js-mindmap



到目前为止,我已经尝试过了。

 $('。node.active')。mousedown(function(){
var url = $(this).attr('href');
窗口。 location(url,'_blank');
});

还在学习javascript / jquery:)

感谢您的一切!!!

解决方案

对于寻找解决方案的人来说,我为此做了一个小的解决方法。



由于我的主要气泡只是容器,它们的href值是#,而每个气泡上的最后一项是真实的链接。


$ b $因此,在以

开头的函数的script.js中,
$ b

  var addLI = function(){

将onlick函数改为这个

  onclick:function(node){
var thelink = $(this).attr('href');
if(thelink!='#'){
window.open(thelink,'_blank');

$ {
$(node.obj.activeNode.content).each(function(){
this.hide();
});
$(node.content).each(function(){
this.show();
});
}

希望它有帮助!


I just found this js for creating a mindmap, and the only thing that doesn't work are the links. I'm linking to the github as it would be way too much code to place here: https://github.com/kennethkufluk/js-mindmap

I've tried this so far..

$('.node.active').mousedown( function(){
    var url = $(this).attr('href');
    window.location(url, '_blank');
});

Still learning javascript/jquery :)

Thanks for everything!!!

解决方案

For anyone looking for a solution, I made a small workaround for this.

Since my main "bubbles" are just containers, their href value is #, while the last items on each bubble are real links.

So, in script.js on the function that starts with

var addLI = function() {

change the onlick function to this

  onclick:function(node) {
    var thelink = $(this).attr('href');
    if ( thelink != '#' ) {
        window.open(thelink, '_blank');
    }
    else {
        $(node.obj.activeNode.content).each(function() {
          this.hide();
        });
        $(node.content).each(function() {
          this.show();
        });
    }

Hope it helps!

这篇关于链接不工作在js-mindmap上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆