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
 
Start new topic
Odpowiedzi
ir3nicus
post
Post #2





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

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


  1. <span class="advert" style="background: url('../admin/offerPhotos/<?= $d[0]['id_offer']; ?>/thumbs/<?= $d[0]['mainPhoto']; ?>');";>
  2. <span class="promo">
  3.  
  4. <a class="tit" style="background-color:#FF7B00" rel="../admin/offerPhotos/<?= $d[0]['id_offer']; ?>/thumbs/<?= $d[0]['mainPhoto']; ?>" href='#promo1'>1</a>
  5. <a class="tit" rel="../admin/offerPhotos/<?= $d[1]['id_offer']; ?>/thumbs/<?= $d[1]['mainPhoto']; ?>" href='#promo2'>2</a>
  6. <a class="tit" rel="../admin/offerPhotos/<?= $d[2]['id_offer']; ?>/thumbs/<?= $d[2]['mainPhoto']; ?>" href='#promo3'>3</a>
  7. <a class="tit" rel="../admin/offerPhotos/<?= $d[3]['id_offer']; ?>/thumbs/<?= $d[3]['mainPhoto']; ?>" href='#promo4'>4</a>
  8.  
  9.  
  10.  
  11. <span class="bo1" id="promo1" ><a href="oferta/<?= $d[0]['id_offer']; ?>/<?= Utils::getLinkForm($d[0]['title']); ?>"><?= UtilsHTML::trunc($d[0]['title'], 40); ?></a></span>
  12. <span class="bo1" id="promo2" style="display:none";><a href="oferta/<?= $d[1]['id_offer']; ?>/<?= Utils::getLinkForm($d[1]['title']); ?>"><?= UtilsHTML::trunc($d[1]['title'], 40); ?></a></span>
  13. <span class="bo1" id="promo3" style="display:none";><a href="oferta/<?= $d[2]['id_offer']; ?>/<?= Utils::getLinkForm($d[2]['title']); ?>"><?= UtilsHTML::trunc($d[2]['title'], 40); ?></a></span>
  14. <span class="bo1" id="promo4" style="display:none";><a href="oferta/<?= $d[3]['id_offer']; ?>/<?= Utils::getLinkForm($d[3]['title']); ?>"><?= UtilsHTML::trunc($d[3]['title'], 40); ?></a></span>
  15.  
  16.  
  17. </span>
  18. </span>


Ten post edytował ir3nicus 22.04.2011, 12:03:04
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 7.10.2025 - 23:16