-
ID:aWL9DL さんの質問

開閉式のアコーディオンメニューを作りたいのですが、下記URLのものをそのまま利用しても動きません。。。
http://kachibito.net/snippets/basic-panel

なにか間違っていますでしょうか。↓

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>無題ドキュメント</title>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(’#faq .answer’).not(’:first’).hide();
$(’#faq .question’).click(function() {
if($(this).next(’.answer’).is(’:visible’)) {
$(this).next(’.answer’).slideUp(300);
} else {
$(this).next(’.answer’).slideDown(300).siblings(’.answer’).slideUp(300);
}
});
</script>
<style type="text/css">
.question {
padding: 5px;
font-weight: bold;
font-family: Arial;
font-size: 14px;
border: 1px solid #ddd;
background: #eee;
cursor: pointer;
}
.answer {
padding: 25px;
font-family: Arial;
font-size: 13px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<div id="faq">
<div class="question">Question 01</div>
<div class="answer">Answer 01<br />
Answer 01<br />
Answer 01<br />
Answer 01<br />
</div>
<div class="question">Question 02</div>
<div class="answer">Answer 02<br />
Answer 02<br />
Answer 02<br />
Answer 02<br />
</div>
<div class="question">Question 03</div>
<div class="answer">Answer 03<br />
Answer 03<br />
Answer 03<br />
Answer 03<br />
</div>
</div>
</body>
</html>

みんなの回答 3 件

ID:DE9tcD さんの回答

<script>
$(function(){
//jQueryはここに書いてください
});
</script>

ID:DlNbAj さんの回答

javascriptを
$(function(){
$(’#faq .answer’).not(’:first’).hide();
$(’#faq .question’).click(function() {
if($(this).next(’.answer’).is(’:visible’)) {
$(this).next(’.answer’).slideUp(300);
} else {
$(this).next(’.answer’).slideDown(300).siblings(’.answer’).slideUp(300);
}
});
});
ってしてみ

ID:aWL9DL さんの回答

回答ありがとうございます!
無事に動きました…
初歩的なミスを****ていたようですね。
どうもありがとうございました!!

ID:aWL9DL

チョメチョメ?

ID:aWL9DL

「おかして」の漢字でした。

最終更新日:2014-10-02 (2,407 views)

関連するトピックス

ページ上部に戻る