Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jak pod jeden link podpiąć skrypt, który po każdorazowym kliknięciu wywoła kolejnego div'a?
marcus755
post
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 1
Dołączył: 6.12.2012

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


Hej wszystkim,

zrobiłem coś takiego:

<div id="bloki" style="display:block;">
<div id="blok_1" style="width:200px; height:100px;">Lorem ipsum 1</div>
<div id="blok_1" style="width:200px; height:100px;">Lorem ipsum 2</div>
<div id="blok_1" style="width:200px; height:100px;">Lorem ipsum 3</div>
<div id="blok_1" style="width:200px; height:100px;">Lorem ipsum 4</div>
</div>

<div id="bloki2" style="display:none;">
<div id="bloki_2" style="width:200px; height:100px;">Lorem ipsum 11</div>
<div id="bloki_2" style="width:200px; height:100px;">Lorem ipsum 21</div>
<div id="bloki_2" style="width:200px; height:100px;">Lorem ipsum 31</div>
<div id="bloki_2" style="width:200px; height:100px;">Lorem ipsum 41</div>
</div>

<div id="bloki3" style="display:none;">
<div id="blok_3" style="width:200px; height:100px;">Lorem ipsum 110</div>
<div id="blok_3" style="width:200px; height:100px;">Lorem ipsum 210</div>
<div id="blok_3" style="width:200px; height:100px;">Lorem ipsum 310</div>
<div id="blok_3" style="width:200px; height:100px;">Lorem ipsum 410</div>
</div>

<a id="next" class="next" href="#">next div</a>

<script>
$(document).ready(function() {
$('#next').click(function(){
$('div#bloki2:hidden').fadeIn();
});
});
</script>

Jak zrobić, żeby jak kliknę jeszcze raz w ten sam link,
wywołał mi id="bloki3" ?

Ten post edytował marcus755 8.01.2013, 10:01:45
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
cfk
post
Post #2





Grupa: Zarejestrowani
Postów: 125
Pomógł: 1
Dołączył: 8.01.2005
Skąd: Warszawa

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


spróbuj skorzystać z czegoś takiego

  1. //pierwsze klikniecie
  2. document.getElementById('blok2').style.display=='block';
  3.  
  4. //kazde kolejne
  5. if ((document.getElementById('blok2').style.display=='block')
  6. {
  7. document.getElementById('blok3).style.display='block';
  8. }

napisz to jako funkcje i podłącz na onclick
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 - 08:37