如何在 d3 函数内更改具有与其关联的 id 的所有 href 选项卡的颜色,并适用于该 id 可用的其他 html 页面
I want to highlight rows that meet a condition as well as highlight an html tab with an id #htmlTab using d3
my code looks like this:
d3.rows.style('background-color', function(d){
if(row meets condition){
document.querySelector("#htmlTab").style.color = "orange";
return 'orange'}
})
So at first d3 will highlight the rows if it meets the condition and then queryselector will color the #htmlTab 。 The problem I am having is that it is only changing the color of the the one tab that has the d3 table. I want it to color all the tabs that has an id #htmlTab on different pages as well. If this code is outside the d3.style function, it works for all the html tabs with that id: document.querySelector("#htmlTab").style.color = "orange";
I want to highlight rows that meet a condition as well as highlight an html tab with an id #htmlTab using d3
my code looks like this:
d3.rows.style('background-color', function(d){
if(row meets condition){
document.querySelector("#htmlTab").style.color = "orange";
return 'orange'}
})
So at first d3 will highlight the rows if it meets the condition and then queryselector will color the #htmlTab. The problem I am having is that it is only changing the color of the the one tab that has the d3 table. I want it to color all the tabs that has an id #htmlTab on different pages as well. If this code is outside the d3.style function, it works for all the html tabs with that id: document.querySelector("#htmlTab").style.color = "orange";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论