.load() を使用してメニューをロードすると、うまく機能します。しかし、このプリロードされたメニューから同じ方法でサブメニューをロードできないようです。
ここに私のメニューがあります:
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Titre de la page</title>
<link rel="stylesheet" href="style.css">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="loader.js"></script>
</head>
<body>
<div id="wrapper">
<div id="menu">
<img src="images/logo.jpg" /><br>
Illustrator & Art Director
<p><br><br><br>
<a href="#" id="about">About Ātman</a><br>
<a href="#" id="illustration">Illustration</a><br>
<a href="#" id="graphic">Graphic Art</a><br>
<a href="#" id="contact">Contact</a></p>
</div>
<div id="main"></div>
<div id="boutons"></div>
</div>
</body>
loader.js は次のとおりです。
$(document).ready(function(){
// load index page when the page loads
$("#main").load("illustration.html #aacc");
$("#boutons").load("boutons.html #illustrations");
$("#about").click(function(){
$("#main").load("about.html");
});
$("#illustration").click(function(){
$("#main").load("illustration.html #aacc");
$("#boutons").load("boutons.html #illustrations");
});
$("#graphic").click(function(){
$("#main").load("graphic.html #navet");
$("#boutons").load("boutons.html #graphic");
});
$("#contact").click(function(){
$("#main").load("contact.html");
});
$("#img1").click(function(){
$("#main").load("illustration.html #aacc");
});
$("#img2").click(function(){
$("#main").load("illustration.html #navet");
});
$("#lol").click(function(){
alert('you clicked me!');
});
});
メニューからロードされたサブメニュー (boutons.html) は次のとおりです。
<body>
<div id="illustrations">
<table border="0" width="200" cellpadding="1" cellspacing="1">
<tr>
<td><a href="#" id="img1"><img src="images/bouton/BI1.jpg" alt="" /></a></td>
<td><a href="#" id="img2"><img src="images/bouton/BI5.jpg" alt="" /></a></td>
<td><a href="#" id="lol">About Ātman</a></td>
</tr>
</table>
</div>
</body>
illustration.html から読み込みたいコンテンツは次のとおりです。
<body>
<div id="aacc">
<img src="images/I/AACC.jpg" alt="AACC" />
<div id="en">NO ADVERTISING EXCEPT BETC poster for open door day (concept, art direction, paper sculpture)</div>
<div id="fr">PAS DE PUB SAUF BETC affiche pour la journée porte ouverte (concept, direction artistique, sculpture en papier)</div>
</div>
<div id="navet">
<img src="images/I/navet.jpg" alt="navet" />
<div id="en">NAVET illustration for comics cover (paper sculpture)</div>
<div id="fr">NAVET illustration pour couverture de bande dessinée (sculpture en papier)</div>
</div>
</body>
テスト用に「笑」を作ったのですが、うまくいきません。何も起こりません。
よろしくお願いします:)