Здравствуйте! Есть код
| Код | <!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" xml:lang="ru-ru" lang="ru-ru" > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Главная страница</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $("button#c").click(function () { $("div#t").slideToggle("slow"); }); }); </script> </head> <body> <button id='c'>Toggle</button> <div id='t' style='border: 1px red solid; float: none; display: none;'>Some text1</div>
<button id='c'>Toggle</button> <div id='t' style='border: 1px red solid; float: none; display: none;'>Some text2</div>
<button id='c'>Toggle</button> <div id='t' style='border: 1px red solid; float: none; display: none;'>Some text3</div>
<button id='c'>Toggle</button> <div id='t' style='border: 1px red solid; float: none; display: none;'>Some text4</div> </body> </html>
|
кнопки и слои под ними генерятся скриптом. Скрипт подразумевает что на главной странице сайта могут быть несколько новостей, поэтому выводит 4 блока. Когда жмёшь на кнопку раскрываются все слои, а надо только там где нажал. Как? |