Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][JavaScript] Ukrywanie części tekstu w divie.
xebo
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 9.04.2011

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


Witam

Mma pewien problem z tym skryptem.


  1. <script type="text/javascript">
  2. function hideshow(which){
  3. if (!document.getElementById)
  4. return
  5. if (which.style.display=="block")
  6. which.style.display="none"
  7. else
  8. which.style.display="block"
  9. }
  10. </script>


  1. <a href="java script:hideshow(document.getElementById('tresc'))">Click here</a>



Chodiz o to że po kliknieciu na "Click here" w kazdym z newsów zamiast otwierac ukrytą zawartośc tego którego klikam, otwiera wartośc tylko pierwszego newsa.

podaję link do sprawdzenia

http://pogaduchynaluzie.xaa.pl/naluziefm/

pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Robert1985
post
Post #2





Grupa: Zarejestrowani
Postów: 84
Pomógł: 7
Dołączył: 5.08.2009
Skąd: Tychy

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


  1. $(document).ready(function(){
  2. var current;
  3. $(".link").click(function(event) {
  4. event.PreventDefault();
  5. current = $(this).next(".tresc");
  6. $(".tresc").not(current).slideUp('fast');
  7. current.slideDown("fast");
  8. });
  9. });

Czy ta funkcja zadziała ?

Ten post edytował Robert1985 10.02.2012, 21:07:10
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: 4.10.2025 - 00:20