2012-03-28 3 views
0

다음 중 어떤 것을 사용하고 있습니까? 상자가 colorbox를 닫습니다. 닫음

$.colorbox({href:"fff.html", 
    onClosed:function(){ window.parent.location.reload(true); } 
    }); 

나는 상자가 크기를 크기를 조정로드 된 후 나는 크기 조정 기능을 사용할 수 있다는 것을 알고

로드 된 후에는 onClosed를 오버라이드 (override) 할 수있을 것인지 그냥 궁금입니다. 내 목표를 달성하기 위해 비슷한 기능을 사용할 수 있습니까? 청소기 해결책이있을 수 있지만

답변

3

당신은

$.colorbox({href:"fff.html", 
    onClosed:function(){ 
     //This is your method that triggers onClose 
     // SO go ahead, override it 

     //You can also call multiple function on it like 

     function1(); //call function 1 
     function2(); //call function 2 
    } 
}); 

또는 시도하는 방식 그대로 그것을 할 수 있습니다, 당신은 다른 일이 주위를 재정의했다

$.colorbox({href:"fff.html", 
    onClosed: overrideFunction 
}); 

function overrideFunction() { 
    /your overriding function 
} 
1

, 당신이 할 수있는 것은

// in the window scope! Can be explicitely set with 
// window.onColorboxClose without var before it. 
var onColorboxClose = function(){ 
}; 

$.colorbox({ 
    href:"fff.html", 
    onClosed:onColorboxClose 
}); 

하고 다음 colorbox의 특성에 폐쇄로 전달보다 이후에 오히려 기능을 덮어 씁니다.

0

처럼 너무)합니다 (onClosed에 함수 이름을 전달할 수 있습니다 닫기 이벤트를 처리하여 닫기 이벤트 처리를 완벽하게 제어합니다.

var c_close = $.fn.colorbox.close; 
    // Now disable the close function 
    $.fn.colorbox.close = function(){ 

     if(confirm('Are you sure?')){ 
      c_close(); 
     } else { 
      return false; 
     } 
    };