1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
$(function() {
$("#sortable").sortable({
// Evenement appelé lorsque l'élément est relaché
stop: function(event, ui){
// Pour chaque item de liste
$("#sortable").find("li").each(function(){
// On actualise sa position
index = parseInt($(this).index()+1);
id = ($(this).attr("id"));
//alert("position : " + index + " id : " + id);
//on recupère l'id
//Ensuite on enregistre en bdd :)
//on enregistre en base de données :)
//alert("position : " + index + " id : " + id + " nombre d'image : "+compte);
$(location).attr("href", "drag_drop_jquerybis.php?position="+index+"&id="+id);
//sdocument.location.href="drag_drop_jquerybis.php?position="+index;
//On la met à jour dans la page
$(this).find(".count").text(index);
});
}
});
//$("#sortable").disableSelection();
}); |
Partager