Implement hoverpic using stimulus.

This commit is contained in:
Jan Böhmer 2022-07-29 23:54:49 +02:00
parent 9519150fb9
commit 671e0944a2
6 changed files with 25 additions and 10 deletions

View file

@ -0,0 +1,20 @@
import {Controller} from "@hotwired/stimulus";
import {Popover} from "bootstrap";
export default class extends Controller {
connect() {
const thumbnail_url = this.element.dataset.thumbnail;
this._popover = Popover.getOrCreateInstance(this.element, {
html: true,
trigger: 'hover',
placement: 'right',
container: 'body',
content: function () {
return '<img class="img-fluid" src="' + thumbnail_url + '" />';
}
});
this._popover.hide();
}
}