Open christianw opened 7 years ago
thanks for letting me know. link: http://examples.julienrenaux.fr/d3js/wordcloud/
Thanks, this one works perfectly :-)
How can I make the texts clickable?
@AppWerft I haven't tested it with this code, but I would add
.on('click', (d, i) => {
//do something
})
in the selection.enter()
part, but before .transition()
, around line 68. That's where the text items are created. You can also append mouseover and -out events to change the mouse cursor.
Thanks I will try and will send you feedback.
It works! http://hosdev.sub.uni-hamburg.de/ (Klick on left cloud)
Yes, it even works perfectly, thx! Otherwise, I also use another solution by attaching an listener to the parent div. So that clicking on a keyword can interact with other modules outside the scope if needed.
document.getElementById(parentDiv).addEventListener('click', function(e) {
let text = (e.target.tagName === "text") ? e.target.innerHTML : null;
if (text) {
// do something...
}
}, false);
Here an example https://jgorene.github.io/ical-vision/index.html
Your demo is currently not working due to the https website whereas the content comes from an unencrypted site.