作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Carrot Search FoamTree 代码将超链接添加到我的 html 页面。这是我的代码:
<script>
// Initialize FoamTree after the whole page loads to make sure
// the element has been laid out and has non-zero dimensions.
window.addEventListener("load", function() {
var foamtree = new CarrotSearchFoamTree({
// Identifier of the HTML element defined above
id: "visualization",
// Some data to visualize.
dataObject: { groups: [
{ label: "Alkaloid", weight: 1.0, trigger: true},
{ label: "Flavonoids", weight: 3.0 },
{ label: "Terpenoids", weight: 2.0 },
{ label: "Alkaloid", weight: 1.0 },
{ label: "Flavonoids", weight: 3.0 },
{ label: "Terpenoids", weight: 2.0 },
{ label: "Steroids", weight: 4.0 }
]},
});
});
</script>
我想生成生物碱、类黄酮、萜类化合物和类固醇的超链接。我该怎么做?
最佳答案
我通过将额外的参数传递到数据对象中解决了这个问题,当泡沫树深入到另一个泡沫树时特别有用。我对圆圈做同样的事情,例如将parentId和parentName传递给子对象,这样当onclick事件触发时,您就可以在事件对象中获得所需的所有信息,因为它只是向您传递该对象,其中包含您的 group
,因此传递要在事件中使用的 url
可以简单地放入 group
对象中。
关于javascript - 如何将超链接传递到 Carrot Search FoamTree?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31288692/
我是一名优秀的程序员,十分优秀!