2012-01-04 41 views
0

我正在使用colorbox/jquery.colorbox.js。 我有下面的代碼(下面),它工作正常。 我想弄清楚如何從iframe中關閉它。 從常見問題,我試圖 onClick='parent.$.colorbox.close(); return false;' 但得到的錯誤Permission denied to access property '$'

感謝您的幫助。 。

$(".iframepop").colorbox({ 
    width:"630px", height:"650px", iframe:true, overlayClose: false, fastIframe: false, 
    onOpen:function(){ 
     iframeID = $(this).attr("id"); 
    }, 
    onLoad:function(){ 
     $('#secureContent').animate({width: "600px"}, 'fast'); 
    }, 
    onCleanup:function(){ 
    }, 
    onClosed:function(){ 
     switch($(this).attr("id")){ 
      case 'goto_home': 
       window.location = "/secure/iframeredirect.php"; 
       break; 
      case 'goto_myaccount': 
       document.body.style.cursor = 'wait'; 
       window.location = "/myaccount"; 
       break; 

     } 
    } 
}); 
+0

也許嘗試'parent.jQuery.colorbox.close();'呢? – 2012-01-04 05:33:20

+2

無喜歡.. 權限被拒絕訪問屬性「jQuery」 第1行 – randy 2012-01-04 16:55:29

回答

0

可以使用$( '#cboxClose')刪除();關閉iframe中的colorbox。

0

.remove()只是刪除了關閉按鈕,使用$('#cboxClose').click();