Mateusz Urbański
Mateusz Urbański

Reputation: 7872

Bootstrap 3 popover

I have a popover which displays the image: my html:

 %a#btn2{"data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}".html_safe ,"data-placement" => "bottom"} Click to toggle popover

my 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}"

How can I do it?

Upvotes: 0

Views: 121

Answers (1)

Andreas Folkesson
Andreas Folkesson

Reputation: 475

You can set the content in the js function that defines the popover.

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/

Upvotes: 1

Related Questions