diff --git a/src/index.js b/src/index.js index 6c43c89..7024cda 100644 --- a/src/index.js +++ b/src/index.js @@ -115,7 +115,7 @@ const data = [ // list of graph elements to start with } ]; // 아래는 공식 사이트에 올라와 있는 예제 코드입니다 -var cy = cytoscape({ +const cy = cytoscape({ container: document.getElementById('cy'), // container to render in @@ -149,4 +149,11 @@ var cy = cytoscape({ fit: true, tile: true } +}); + +cy.on('tap', function (e) { + const url = e.target.data('url') + if (url && url !== '') { + window.open(url); + } }); \ No newline at end of file