【问题标题】:Loading a partial (external) html page using colorbox jquery plugin使用colorbox jquery插件加载部分(外部)html页面
【发布时间】:2012-07-02 00:14:37
【问题描述】:

如何让它在链接的 html 页面中仅使用包含 div。加载完整页面很好。但是我希望只加载加载页面的子 div。

html

<a href="/OrchardLocal/FactFindPreview?id=5" class="cboxElement">View Fact Submission</a> 

jquery(准备好文档)

$(".required-info a").colorbox({ iframe: true, width: "80%", height: "80%" }); 

【问题讨论】:

  • 嗯,问题标题的长度超过了问题的正文。
  • 在问题正文中添加您的代码... :)

标签: jquery colorbox


【解决方案1】:

ColorBox 的 ajax 功能由 jQuery 的 load() 方法处理,因此它的工作方式相同。您传递给 colorbox 的 URL 必须以空格为后缀,然后是您要显示的内容的选择器。例如:$.colorbox({href: "mypage.html #myselector"});

您的用法如下所示:

$(".required-info a").colorbox({ href: function(){ return $(this).attr('href') + ' #mycontainer'; }, width: "80%", height: "80%" });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多