我使用wordpress和jquery colorbox插件,并且我正在从我的网站加载一个内部页面到iframe。我想只加载特定的div ID,或者隐藏特定的div ID或类。我读过Colorbox Load Specific div from iFrame,但不幸的是我无法获得此代码的工作,整个页面继续显示在iframe中。我的链接用class .colorbox-link标识,我试图只在iframe中显示#main的div。这里是我当前的代码,我已经放置在header.php中:Colorbox iframe - 仅加载特定div
<script type="text/javascript">
$(window).load(function() {
var $iframe = $(".colorbox-link");
$(".colorbox-link").colorbox({
href: $(".colorbox-link").attr('href') + " #main",
});
});
</script>
很抱歉,如果这是一个jQuery新手的问题 - 在此先感谢您的帮助!