[英]Bootstrap 3 popover
I have a popover which displays the image: my html: 我有一个显示图片的弹出窗口:我的html:
%a#btn2{"data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}".html_safe ,"data-placement" => "bottom"} Click to toggle popover
my js: 我的js:
$('#btn2').popover trigger: "hover", html: true
I want to export this fragment to my js: "data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}"
我想将此片段导出到我的js:
"data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}"
How can I do it? 我该怎么做?
You can set the content in the js function that defines the popover. 您可以在定义弹出框的js函数中设置内容。
It would be something like this: 就像这样:
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/ http://jsfiddle.net/afolkesson/s9L9A/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.