Javascript Colorbox IE显示内联href函数不';不会在第二次单击同一链接时触发
嗨,希望有人能帮忙。一直试图在颜色框中显示一些隐藏的内联内容。在firefox中,一切都很好,但在IE8中,第一次工作正常,第二次失败。当使用警报(id)时,id变量在IE中第二次显示为未定义 我尝试了一个点击处理程序来设置id,我得到了相同的结果。下面是一些示例html(为清晰起见简化)。这是由Drupal CMS生成的Javascript Colorbox IE显示内联href函数不';不会在第二次单击同一链接时触发,javascript,jquery,jquery-plugins,colorbox,Javascript,Jquery,Jquery Plugins,Colorbox,嗨,希望有人能帮忙。一直试图在颜色框中显示一些隐藏的内联内容。在firefox中,一切都很好,但在IE8中,第一次工作正常,第二次失败。当使用警报(id)时,id变量在IE中第二次显示为未定义 我尝试了一个点击处理程序来设置id,我得到了相同的结果。下面是一些示例html(为清晰起见简化)。这是由Drupal CMS生成的 <div class="my-div"> <a class="pop-extra nid-628 cboxElement" href="/alex-
<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>
}))
要查看演示,请查看以下url:
要在IE8中复制,请单击其中一个图像,然后关闭图像,然后再次单击它。将内容放入另一个div,然后在其前面的div中显示:无。我在提供的链接中未发现任何问题。在IE8中,它对我来说很好。第二次单击同一链接时就会发生这种情况
$(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();
});