JQuery Facebox 插件:将其获取到表单标签内

发布于 2024-07-06 17:56:24 字数 147 浏览 10 评论 0原文

我想使用 JQuery 的 Facebox 插件,但在让它按照我想要的方式运行时遇到一些问题。 容纳 Facebox 内容的 div 是在标签外部创建的,因此即使我加载了一些 Web 控件,它们也不会返回到服务器。

有没有人处理过这个问题可以给我一些指示?

I am wanting to use the Facebox plugin for JQuery but am having a few issues getting it running how I want. The div that houses the facebox content is created outside of the tag so even though I am loading up some web controls none of them are firing back to the server.

Has anyone dealt with this that can give me some pointers?

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

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

发布评论

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

评论(4

离鸿 2024-07-13 17:56:24

浏览 Facebox.js 我在函数 init(settings) 中遇到了这一行...

$('body').append($.facebox.settings.faceboxHtml)

我将其更改为...

$('#aspnetForm').append($.facebox.settings.faceboxHtml)

并且它加载到表单标签中,尚不确定是否有任何副作用

poking around the facebox.js I came across this line in the function init(settings)...

$('body').append($.facebox.settings.faceboxHtml)

I changed that to ...

$('#aspnetForm').append($.facebox.settings.faceboxHtml)

and it loads up in the form tag, not sure yet if there are any side effects

嗼ふ静 2024-07-13 17:56:24

您可以使用此代码来注册 PostBack 事件:

btn.OnClientClick = string.Format("{0}; $.facebox.close();",ClientScript.GetPostBackEventReference(btn, null));

这将使按钮触发 PostBack。

You can use this code to register the PostBack event:

btn.OnClientClick = string.Format("{0}; $.facebox.close();",ClientScript.GetPostBackEventReference(btn, null));

this will let the button fires a PostBack.

梦里兽 2024-07-13 17:56:24

即使在之后:
$('#aspnetForm').append($.facebox.settings.faceboxHtml)

更改我发现它有问题。 当您使用 firebug 查看页面源代码时,您会发现分配给 Facebox div 的 div 中的所有 html 都被加倍(重复)。

因此,所有这些具有假定唯一 id 的控件都会在页面上加倍,这在回发时效果不佳,我决定将 ASP.NET Web 控件放入 Facebox 中不是一个好主意。

Even after the :
$('#aspnetForm').append($.facebox.settings.faceboxHtml)

change I found it problematic. When you look at the page source using firebug you see that all the html in the div assigned to be the facebox div is doubled up (repeated).

So all of those controls with supposed unique id's are doubled up on the page, that can't be good on the postback, i've decided putting asp.net web controls in a facebox is not a good idea.

合约呢 2024-07-13 17:56:24

我修改了 facbox.js 来做到这一点。 也许有更好的解决方案,但这就像一个魅力,

我做了什么:

  1. 在 facbox.js 顶部 '(function($)' 之前添加两行,
var willremove = '';
var willremovehtml = '';
  1. 找到“reveal: function(data, klass) {”并添加此行在函数的第一行之前
willremove = data.attr('id')
willremovehtml = $('#'+willremove).html()
$('#'+willremove).html('')
  1. 找到“close: function() {”并使其如下所示。
close: function() {
$(document).trigger('close.facebox')
$('#'+willremove).html(willremovehtml)
willremovehtml = ''
willremove = ''
return false
}

I modified facbox.js to do this. Maybe there is a better solution but this works like a charm

Here what i did:

  1. add two lines on top of facbox.js before '(function($)'
var willremove = '';
var willremovehtml = '';
  1. find "reveal: function(data, klass) {" and add this lines before the first line of function.
willremove = data.attr('id')
willremovehtml = $('#'+willremove).html()
$('#'+willremove).html('')
  1. find "close: function() {" and make it look like below.
close: function() {
$(document).trigger('close.facebox')
$('#'+willremove).html(willremovehtml)
willremovehtml = ''
willremove = ''
return false
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文