Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z jquery ('#div').show
ir3nicus
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 16.11.2010

Ostrzeżenie: (0%)
-----


Witam, mam nastepujacy skrypt:

  1.  
  2.  
  3. <title>TEST SLIDERA</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
  5. <meta name="author" content="lukasz_os" >
  6. <script type="text/javascript" src="jquery-1.5.1.min.js"></script>
  7. <script type="text/javascript">
  8. function rotate(){
  9. last=$("#container .news").index($('.news:last')[0]);
  10. ind=$("#container .news").index($('.news:visible')[0]);
  11. $('.news').eq(ind).hide();
  12. if(ind==last){
  13. ind="0";
  14. }
  15. else
  16. {
  17. ind++;
  18. }
  19. $('.news').eq(ind).show();
  20. }
  21. $().ready(function(){
  22. $('#container .news:first').show();
  23. var inter = setInterval("rotate()",2000);
  24.  
  25.  
  26. $(".tit").click(function() {
  27.  
  28. clearInterval(inter);
  29.  
  30.  
  31. var href = $(this).attr("href");
  32.  
  33. $('.tit').css('background-color', 'white');
  34. $(this).css('background-color', 'green');
  35. $('.news').hide();
  36. $(href).show();
  37. return false;
  38. });
  39.  
  40. });
  41. <style type="text/css">
  42. * {
  43. margin:0;
  44. padding:0;
  45. }
  46. body {
  47. background:#ffffff;
  48. color:#000;
  49. }
  50. .news {
  51. width:300px;
  52. height:200px;
  53. border:1px solid #000;
  54. display:none;
  55. }
  56. #container {
  57. margin:20px;
  58. width:302px;
  59. height:202px;
  60. }
  61. </head>
  62.  
  63. <div id="container">
  64. <div class="news" id="#n1" style="background-color:red;">
  65. div 1ijiojiji
  66. </div>
  67. <div class="news" id="#n2" style="background-color:green;">
  68. div 2joijioj
  69. </div>
  70. <div class="news" id="#n3" style="background-color:black;">
  71. div 3iojioj
  72. </div>
  73. <div class="news" id="#n4" style="background-color:yellow;">
  74. div 4iojioj
  75. </div>
  76. </div>
  77.  
  78. <a class="tit" href='#n1'>1</a>
  79. <a class="tit" href='#n2'>2</a>
  80. <a class="tit" href='#n3'>3</a>
  81. <a class="tit" href='#n4'>4</a>
  82.  
  83.  
  84. </body>
  85. </html>


Jednakze po kliknieciu przycisku div o id "href" sie nie wyswietla czy ktos wie czemu ?

Ten post edytował ir3nicus 21.04.2011, 14:32:10
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 02:00