1

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!!!

Reuben
  • 2,701
  • 6
  • 31
  • 47

3 Answers3

1

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!

Ignacio
  • 133
  • 1
  • 13
0

For opening a new window every time you need to use window.open

window.open(url, '_blank');
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
0

You may try this,it would open in new window

var a=$(this).attr('href').attr('target','_blank');
xCoder
  • 11
  • 4