2012-03-14 3 views
3

iframe에서 열리는 colorbox 창이 있습니다. 그 창 안에는 사용자가 클릭 할 수있는 링크가 있으며 이상적으로는 현재의 colorbox 창이 닫히고 새로운 iframe에서 (또는 다시) 새 colorbox 창이 열리거나 기존 iframe에 새로운 내용을로드하고 싶습니다.iframe이있는 색상 상자 - 닫은 다음 다른 하나를 열기

나의 첫번째 창이과 같이 열립니다 내가 처음 창을 닫습니다 시도했습니다

$.colorbox({ width: "800px", height: "580px", iframe: true, href: "/App/Note?nodeId=" + nodeId }) 

: 그 첫 번째 창에 표시하는 링크를 클릭하면

$.colorbox({ width: "800px", height: "580px", open: true, iframe: true, href: '/App/View?id=' + id }); 

이 해고되는 것입니다 다음을 포함합니다 :

parent.$.colorbox.close(); 

하지만 두 창을 모두 닫습니다.

나는 시도하고 두 번째 창은 첫 번째 창의 내용에 열리고 내가이 개 국경을 폐쇄하지 않은 경우 등이 개 닫기 버튼

어떤 아이디어가?

감사합니다.

답변

8

첫 번째 colorbox를 닫은 다음 부모의 컨텍스트를 사용하여 새 colorbox를 엽니 다.

parent.$.colorbox.close(); 
parent.$.colorbox({ width: "800px", height: "580px", iframe: true, href: "/App/Note?nodeId=" + nodeId }); 

사실이 작업을 수행 할 상위 페이지에 기능이 있어야합니다.

function OpenNote(noteId){ 
    $.colorbox.close(); 
    $.colorbox({ width: "800px", height: "580px", iframe: true, href: "/App/Note?nodeId=" + nodeId }); 
} 

그런 다음 noteId를 전달하는보기 페이지 내의 링크를 클릭하면이 기능이 호출됩니다. 닫을 때

parent.OpenNote(id); 
+0

근무 - 감사합니다! –

0

나는 colorbox.My 기능은 열려있는 다른 colorbox에 대한 재귀 함수입니다 사용하고 있습니다 :

<script type="text/javascript"> 
    var colorList = []; 
        colorList.push('1. Popup Content'); 
        colorList.push('2. Popup Content'); 
        colorList.push('3. Popup Content'); 
        colorList.push('4. Popup Content'); 
      colorboxRecursive(colorList); 
    function colorboxRecursive(colorList){ 
     if (colorList.length>0) { 
      $.colorbox({ 
       html:colorList.pop(), 
       onClosed:function(){ 
        if (colorList.length>0) 
         colorboxRecursive(colorList); 
       } 
      }); 
     }else{ 
      return false; 
     } 
    } 
</script> 
관련 문제