[英]jQuery accordion - what's missing?
這是我的代碼;
<head>
<title>page title</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.js"></script>
</head>
<body>
<script>
$(function() {
$( "#accordion" ).accordion();
});
</script>
<div id="accordion">
<h3>-shift title-</h3>
<div><p>-shift content here-</p></div>
<h3>-shift title-</h3>
<div><p>-shift content here-</p></div>
</div>
我確定我錯過了一些東西,但是我的想法是我使用了CDN並將該函數放進去,div沒有崩潰?
問題不包括<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
我認為您使用的是jQuery UI,因此您需要將該庫包含在jQuery下面
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
我不太確定,但我認為您可能會缺少一些CSS文件。
將此用作腳本,讓我們看看它是否有效:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.