gpt4 book ai didi

jquery - 弹出窗口内的 Accordion ,彩盒/模态 Bootstrap

转载 作者:行者123 更新时间:2023-12-01 03:39:12 25 4
gpt4 key购买 nike

我想在弹出窗口中实现 Accordion 。是否可以?我尝试用 colorbox 来做,但似乎不可行,所以我尝试使用 bootstrap modal,但似乎我很困惑。

<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 3.1.0 - Modal Demo</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery-1.8.3.min.js"></script>
<script src="https://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#accordion").accordion({ autoHeight: true });
});
</script>
</head>
<body>
<div class="container">
<h2 style="text-align: center;">Bootstrap 3.1.0 - Modal Demo</h2>
<div class="row text-center">
<h3>The Basic Modal</h3>
<a href="#" class="btn btn-lg btn-success" data-toggle="modal" data-target="#basicModal">Click to open Modal</a>
</div>
<hr>
</div>

<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div id="accordion">
Text / content outside accordion
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Inside section 1
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Inside section 2
</p>
</div>
</div>
</div>
</div>
</div>

</body>
</html>

我的完整代码:http://jsfiddle.net/g6HA4/2/

感谢您的帮助。

最佳答案

您的 JQuery 代码不完整,请更改:

$("#accordion").accordion({
autoHeight: true
});

致:

$(function() { $("#accordion").accordion({
autoHeight: true
});
});

参见Demo

关于jquery - 弹出窗口内的 Accordion ,彩盒/模态 Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25138173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com