-->

KineticJS text as links?

2019-09-04 02:06发布

问题:

Is there anyway to make the texts and/or shapes be hyperlinks? Being that when they are clicked, they bring up new browser and when you hover over them, they show location of the url?

回答1:

You can't make the browser to show the url of links in statusbar which are not an a tag. But you can indeed ad a click handler on kinetic objects and make them act a link.

text.on('click', function() {
    // do something
});

http://jsfiddle.net/4JYGL/