Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   li переместить в конец (https://javascript.ru/forum/jquery/15681-li-peremestit-v-konec.html)

vanderv 09.03.2011 15:50

li переместить в конец
 
<ul>
    <li><img src="/wp-content/themes/twentyten/images/moto1.png" /></li>
    <li><img src="/wp-content/themes/twentyten/images/moto2.png" /></li>
    <li><img src="/wp-content/themes/twentyten/images/moto3.png" /></li>
    <li><img src="/wp-content/themes/twentyten/images/moto4.png" /></li>
    <li><img src="/wp-content/themes/twentyten/images/moto5.png" /></li>
    <li><img src="/wp-content/themes/twentyten/images/moto6.png" /></li>
 </ul>


как на jquery переместить первый li в конец, тобеж поставить после moto6.png

Matre 09.03.2011 18:17

var LI = $("#main li");
$(LI[LI.length - 1]).after(LI[0]);
$(LI[0]).remove();

SkyLight 09.03.2011 21:26

Или же так:
$('ul li:first').appendTo('ul');


Часовой пояс GMT +3, время: 11:30.