I know $(".box").show();
is Jquery is the same as document.querySelector(".box").style.display = "block";
in JS. However, when .show(300)
has a transition fade on it, I can't seem to replicate that in JS.
Upon, 'mouseenter'
, a small tooltip box pops up. Currently I have:
let svgTarget = document.querySelector('svg #target' + newId);
svgTarget.style.fill = 'rgba(0,0,0,0.0)';
svgTarget.addEventListener('mouseenter', function (e) {
d3.select('svg #tooltip' + newId)
.transition()
.duration(5000)
.style("display", "inline");
inOutBehavior(e, hoverState);
},)
The 'mouseenter'
functionality works there's just no smooth transition, it's instantaneous. I'm using D3 to implement the transition but with no luck. I have also tried using an event listener with D3 but that also did not work. Is there a solution with vanilla JS or D3 that I am not seeing? Thanks!