JQuery colorbox 无需在 JSP 文件的 div 中编写另一个 JSP 文件?

发布于 2024-10-22 20:25:47 字数 421 浏览 1 评论 0原文

我正在使用 JQuery colorbox,如下所示:有一个链接(带有按钮),其中有一个类 cboxElement。 colorbox 的 html 位于该链接处,我的意思是在另一个 JSP 文件处。当用户单击该链接颜色框时,一切正常。

但是,如何在页面中的 div 标记之间使用 colorbox(我的意思是,无需编写另一个用户不可见的 JSP 文件,该文件将在用户单击按钮后出现)?

编辑:我发现:如果内联“true”,则 jQuery 选择器可用于显示当前页面的内容。示例:

$("#inline").colorbox({inline:true, href:"#myForm"});

我认为这就是我正在寻找的内容,但我找不到任何示例?

I am using JQuery colorbox like that: There is a link(with a button) that has a class cboxElement. The html of colorbox is at that link, I mean at another JSP file. When user click that link colorbox appears and everything is OK.

However how can I use colorbox for something within my page between div tags I mean without writing another JSP file that will be non-visible for users and it will appear after a user clicks a button)?

EDIT: I found that: If inline 'true' a jQuery selector can be used to display content from the current page. Example:

$("#inline").colorbox({inline:true, href:"#myForm"});

I think this is what I am looking for but I couldn't find any example of it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花ソ最美的依靠 2024-10-29 20:25:47

查看此页面上的内部 HTML 示例。我相信这就是您正在寻找的。

如果您查看页面的源代码,您会发现以下 HTML:

<!-- This contains the hidden content for inline calls -->
    <div style='display:none'>

        <div id='inline_example1' style='padding:10px; background:#fff;'>
        <p><strong>This content comes from a hidden element on this page.</strong></p>
        <p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.<br />
        <a id="click" href="#" style='padding:5px; background:#ccc;'>Click me, it will be preserved!</a></p>

        <p><strong>If you try to open a new ColorBox while it is already open, it will update itself with the new content.</strong></p>
        <p>Updating Content Example:<br />

        <a class="example5" href="../content/flash.html">Click here to load new content</a></p>
        </div>
    </div>

这是单击时启动 ColorBox 的链接:

<p><a class='example8' href="#">Inline HTML</a></p>

这是 ColorBox 的绑定:

$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});

Take a look at the example for inner HTML on this page. I believe that is what you're looking for.

If you look at the source of the page, you'll find this HTML:

<!-- This contains the hidden content for inline calls -->
    <div style='display:none'>

        <div id='inline_example1' style='padding:10px; background:#fff;'>
        <p><strong>This content comes from a hidden element on this page.</strong></p>
        <p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.<br />
        <a id="click" href="#" style='padding:5px; background:#ccc;'>Click me, it will be preserved!</a></p>

        <p><strong>If you try to open a new ColorBox while it is already open, it will update itself with the new content.</strong></p>
        <p>Updating Content Example:<br />

        <a class="example5" href="../content/flash.html">Click here to load new content</a></p>
        </div>
    </div>

This is the link that launches ColorBox on click:

<p><a class='example8' href="#">Inline HTML</a></p>

This is the binding for ColorBox:

$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文