我使用下面的代码为我的移动网站,在选择Accordin将显示它的内容。在默认情况下,我希望在用户加载页面时加载第一个Accordin来加载并显示。我怎样才能实现这一目标。
这是Html文件
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css"
rel="stylesheet" type="text/css">
<style>
body {
font-family: 'Roboto', sans-serif;
background-color:#fafafa;
}
.container {
max-width: 960px;
margin: 150px auto;
}
h3 {
font-weight: normal;
font-size: 16px;
}
</style>
<link href="src/ziehharmonika.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="ziehharmonika">
<h3>Section One</h3>
<div>
<iframe src="http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-5.jpg" height="600px" width="100%"></iframe>
</div>
<h3>Section Two</h3>
<div>
<iframe src="http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-5.jpg" height="600px" width="100%"></iframe>
</div>
<h3>Section Three</h3>
<div>
<iframe src="http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-5.jpg" height="600px" width="100%"></iframe>
</div>
</div>
这是脚本文件
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="src/ziehharmonika.js"></script>
<script>
$(document).ready(function() {
$('.ziehharmonika').ziehharmonika({
collapsible: true,
prefix: '★'
});
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_ gaq.push(['_setAccount', 'UA-36251023-1']);
_gaq.push(['_setDomainName', 'jqueryscript.net']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
任何帮助都会更加感激。
发布于 2017-08-08 05:32:36
最好用JSfiddle制作一个在线版本。
试试这个:
<div class="ziehharmonika">
<h3 class="active">Section One</h3>
<div style="display:block;">
<iframe src="http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-5.jpg" height="600px" width="100%"></iframe>
</div>
<h3>Section Two</h3>
<div>
<iframe src="http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-5.jpg" height="600px" width="100%"></iframe>
</div>
<h3>Section Three</h3>
<div>
<iframe src="http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-5.jpg" height="600px" width="100%"></iframe>
</div>
</div>https://stackoverflow.com/questions/45559819
复制相似问题