javascript - (jQuery/JS) How to *set* a list item to be 1st in a UL or OL regardless of its original order? -
i have working code here:
function portfolio() { $('#main-projects').children().toggle(function () { $(this).css('cursor', 'pointer'); var projectname = $(this).attr('id'); //alert(projectname); projectname = projectname.replace("li-", "main-"); $('.main-details').hide(); $('.main-stage').fadeout(300); $('#' + projectname).delay(300).fadein(900); }, function () { //haven't written callback yet, no worries. }); }
works great already: when click li (child of ul#main-projects
) finds name of hidden slideshow div replacing name of li's id, replaces "li-(name of project)" "main-(name of project)" shows div.
what want (and can't seem find solution to) take li that's been selected , move first in list curate in way slideshow that's been shown above it.
i know how grab item number eq(index) haven't found forces reorder without dragging , dropping. ideas? in advance!
you can use insertbefore
insert before first li
:
also take @ question:
Comments
Post a Comment