我需要關閉用onclick事件覆蓋網站的colorbox iframe。我看過代碼爲parent.$.colorbox.close(); return false;
,但是當我像這樣使用它時,它不起作用:<a onclick="parent.$.colorbox.close(); return false;">close</a>
。我認爲這是因爲我沒有使用標準的colorbox腳本來調用iframe。我修改了它,這樣我可以從HTML錨標記得到高度和寬度:如何使用javascript關閉colorbox iframe?
MY彩盒SCRIPT:
$.noConflict();
jQuery(document).ready(function($){
$("a[rel='colorbox']").each(function(){
var getWidth = parseInt($(this).attr('width'))
var getHeight = parseInt($(this).attr('height'))
var getScroll = parseInt($(this).attr('scrolling'))
if(getScroll == 'yes') { var frameScroll = 'true'; }
if(!getWidth) { var getWidth = '720'; }
if(!getHeight) { var getHeight = '480'; }
$(this).colorbox({innerWidth:getWidth, innerHeight:getHeight, scrolling:frameScroll, iframe:true, rel:"nofollow", transition:"elastic"});
});
});
什麼我需要使用的onclick關閉此iframe?
完美!我知道這與我稱呼它的方式有關! – nitsuj 2012-03-28 20:42:05