怎么在Bootstrap弹出窗口中插入图像

发布时间:2022-03-24 09:58:06 作者:iii
来源:亿速云 阅读:133

本文小编为大家详细介绍“怎么在Bootstrap弹出窗口中插入图像”,内容详细,步骤清晰,细节处理妥当,希望这篇“怎么在Bootstrap弹出窗口中插入图像”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

答案:使用弹出框content选项

您可以将该content选项传递给Bootstrap.popover()方法,以将图像插入到弹出窗口中。您也可以使用data-content属性设置此选项。

让我们尝试以下示例以了解其基本工作原理:

例试试这个代码»

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>Show Images in Bootstrap Popovers</title>

<link rel="stylesheet" href="css/bootstrap.min.css">

<script src="js/jquery-3.5.1.min.js"></script>

<script src="js/popper.min.js"></script>

<script src="js/bootstrap.min.js"></script>

<script>

$(document).ready(function(){

    $('[data-toggle="popover"]').popover({

        placement : 'top',

trigger : 'hover',

        html : true,

        content : '<div class="media"><img src="images/avatar-tiny.jpg" class="mr-3" alt="Sample Image"><div class="media-body"><h6 class="media-heading">Jhon Carter</h6><p>Excellent Bootstrap popover! I really love it.</p></div></div>'

    });

});

</script>

<style>

.wrapper{

     margin: 200px 150px 0;

    }

</style>

</head>

<body>

    <div class="wrapper">

        <button type="button" class="btn btn-primary" data-toggle="popover">Popover without Title</button>

        <button type="button" class="btn btn-primary" data-toggle="popover" title="User Info">Popover with Title</button>

    </div>

</body>

</html>

读到这里,这篇“怎么在Bootstrap弹出窗口中插入图像”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. bootstrap6-响应式图像
  2. bootstrap4-图像

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

bootstrap

上一篇:pycharm如何快速查看函数文档

下一篇:怎么在Bootstrap中禁用选项卡

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》