我有一个弹出窗口,显示图像: my html:
%a#btn2{"data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}".html_safe ,"data-placement" => "bottom"} Click to toggle popover
我的js:
$('#btn2').popover trigger: "hover", html: true
我想将这个片段导出到我的js:"data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}"
我该怎么做呢?
发布于 2014-03-12 18:26:42
您可以在定义popover的js函数中设置内容。
它应该是这样的:
var myPopoverContent = "#{ image_tag CarConfiguration.last.image_url.to_s}".html_safe;
$('#btn2').popover({
trigger: 'hover',
html: true,
content: myPopoverContent
});
http://jsfiddle.net/afolkesson/s9L9A/
https://stackoverflow.com/questions/22347868
复制相似问题