[js] popover中显示图片

有时候我们需要在popover中显示html代码,比如显示图片,那么我们可以这么做:
Html代码

<input id="radio_1" type="radio" rel="popover" data-img="/Images/all.png" checked="checked" value="all" name="a">选项1</label>

Jquery代码

 $('input[rel=popover]').popover({
        html: true,
        trigger: 'hover',
        placement: 'bottom',
        content: function () { return '<img src="' + $(this).data('img') + '" />'; }
    });
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容