Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jak przenosić divy...?
marcus755
post
Post #1





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

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


Hej,
jak zrobić przenieść div'a z klasą test?

<div class="example">
<div class="test">costam 1</div>
<div class="test">costam 2</div>
<div class="test">costam 3</div>
</div>

efekt docelowy

<div class="example">
<div class="test">costam 2</div>
<div class="test">costam 1</div>
<div class="test">costam 3</div>
</div>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
Forti
post
Post #2





Grupa: Zarejestrowani
Postów: 655
Pomógł: 73
Dołączył: 2.05.2014

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


Chyba Cie nie rozumiem. Chcesz to zrobić w stylu "drag and drop" i ma to pozostać tak na stałe czy coś innego?
Go to the top of the page
+Quote Post
marcus755
post
Post #3





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

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


bez "drag and drop"
chce żeby w każdym divie z klasą example pierwszego diva z klasą test przeniósł mi na drugą pozycję (zamienił miejscami ) i tyle:-)

<div class="costam">

<div class="example">
<div class="test">costam 2</div>
<div class="test">costam 1</div>
<div class="test">costam 3</div>
</div>

<div class="example">
<div class="test">costam 2</div>
<div class="test">costam 1</div>
<div class="test">costam 3</div>
</div>

<div class="example">
<div class="test">costam 2</div>
<div class="test">costam 1</div>
<div class="test">costam 3</div>
</div>

</div>

Ten post edytował marcus755 18.02.2015, 09:47:07
Go to the top of the page
+Quote Post
Forti
post
Post #4





Grupa: Zarejestrowani
Postów: 655
Pomógł: 73
Dołączył: 2.05.2014

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


jquery


[JAVASCRIPT] pobierz, plaintext
  1. var first = $('div.example).find('div.test:first-child');
  2. var second = first.closest('div.test');
  3.  
  4. first.insertAfter(second);
  5.  
[JAVASCRIPT] pobierz, plaintext


pisane "na kolanie", nie mam pewności czy zadziała, ale coś w ten deseń.
Go to the top of the page
+Quote Post
marcus755
post
Post #5





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

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


Dzięki:-)
Go to the top of the page
+Quote Post

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: 24.08.2025 - 21:27