2011-01-11 90 views
0

嗨,希望有人能提供帮助。一直试图在彩盒中显示一些隐藏的内联内容。在Firefox中一切都很好用,但在IE8中它第一次工作,然后第二次失败。当使用alert(id)时,id var会在IE中第二次未定义。Colorbox IE显示内嵌href函数不会被第二次触发第二次点击相同的链接

已经尝试过点击处理程序来设置ID,我得到相同的结果。这里有一些示例html(为了清晰起见而简化)。这是由Drupal的CMS生成

<div class="my-div"> 
    <a class="pop-extra nid-628 cboxElement" href="/alex-f">the link triggering colorbox</a> 

    <div id="628" class="inline-content" style="display: none;"> 
    The hidden content to display 
    </div> 
</div> 

这里是我的jQuery

$(document).ready(function() { 
// Hide inline content 
$('.inline-content').hide(); 
//Fire colorbox 
$('a.pop-extra').colorbox(
{ 
height:700, 
width:420, 
inline:true, 
//Set the inline content to display dynamicaly by grabing the next div id 
href: 
function(){ 
id = $(this).next().attr("id"); 
return '#'+id; 
}, 
onOpen:function(){ 
//Show the content so colorbox has something to display 
$('#'+id).show(); 
}, 
}); 

$(document).bind('cbox_closed', function(){ 
//Hide content again when colorbox closes 
    $('#'+id).hide(); 
}); 

});

要查看演示,请看看这个网址: http://eyestoneartists-com-au.kept.com.au/browse-extras/male/all

要重现IE8单击一个图像,然后关闭图像,然后再次单击它。

+0

我在提供的链接中找不到任何问题。它在IE8中可以正常工作。 – rahul 2011-01-11 04:10:53

回答

1

把内容在另一股利和再display:none在一个div之前。

相关问题