2013-03-11 4 views
1

나는 내가 주문할 수있는 이미지의 목록을 가지고있다. 나는 이미지를 주문하려면이 코드를 사용새로 고침 div 외부 파일 없음

$(document).ready(function(){ 

    $(function() 
    { 
     $("#subafbeelding ul").sortable(
     { 
      opacity: 0.6, 
      cursor: 'move', 
      update: function(){ 
       var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
       $(".hoofdafbeelding").load("foo.php"); 
       $.post("updatevolgoorde.php", order, function(theResponse) 
       { 
        $("#contentRight").html(theResponse); 

       });                
      }         
     }); 
    }); 
}); 

$("#contentRight").html(theResponse); 

후 내가 사업부의 headimg를 다시로드합니다. 어떻게 만들 수 있습니까?

좋은 하루 되세요.

+0

[클론 (http://api.jquery.com/clone/) 요소. [숨기기] (http://api.jquery.com/hide/) 복제본. – musefan

+0

다시로드하려는 경우 클론을 템플릿으로 사용하십시오. @mustefan을 수행하는 방법을 모릅니다. –

답변

1

취할 수있는 옵션 중 하나는 페이지를로드 할 때 html 사본을 만드는 것입니다. 숨겨진 요소에 저장 한 다음 html을 다시로드하려면 다시 사용하십시오. 이런

예시 :

$("#storage").html($("#original").html()); 

function addEvents() { 
    $("#original ul").sortable({ 
     opacity: 0.6, 
     cursor: 'move', 
     update: function() { 

     } 
    }); 
} 
addEvents(); 

$("#reset").click(function (e) { 
    e.preventDefault(); 
    $("#original").html($("#storage").html()); 
    addEvents(); 
}); 

다음 HTML 작동 :

<div id="original"> 
    <ul> 
     <li>one</li> 
     <li>two</li> 
     <li>three</li> 
    </ul> 
</div> 
<div id="storage"></div> 
<div> 
    <a id="reset">reset</a> 
</div> 

Here is a working example.