此片段的目的是在單擊單詞時打開帶有圖表的彈出窗口。該圖表仍未包含在popover中,但我一次只能做一步。無法在d3應用程序中的文本標記上添加引導彈出窗口
var childText = svg.selectAll("childText")
.data(...)
.enter().append("text")
.attr("class", "btn btn-lg btn-danger")
.attr("x", "...")
.attr("y", "...")
.attr("font-size", "...")
.attr("fill", "...")
.attr("role", "button")
.attr("data-content", "it works!")
.attr("data-trigger", "focus")
.attr("data-toggle", "popover")
.attr("title", "graph")
.attr("data-content", "yi boi")
.attr("tabindex", "0")
.text("...")
$(document).ready(function() {
$('[data-trigger="focus"]').popover({'show':true});
});
的HTML工作沒有拋出任何錯誤,但是當我點擊的話,什麼都不會發生。我注意到一個特定的屬性(aria-describedby =「popover900071」)在元素內部生成,因爲我點擊該單詞。這是唯一發生的變化,沒有彈出窗口,也沒有錯誤出現。使用
版本:
自舉:3.3.7
D3:3.5.0
(使用其它的庫)C3:0.4.11,jQuery的:3.1.1
Bootstrap popover文檔:http://getbootstrap.com/javascript/#popovers
TL; DR:試圖在d3應用程序中使用Bootstrap的彈出窗口,彈出窗口不會出現,並且不會生成錯誤。
您也可以在此處看到此操作:http://bl.ocks.org/Caged/6476579 – Kerrin631
這適用於預期目的。謝謝你的幫助! –