回传后,jQuery Fancybox无法正常工作 [英] Jquery Fancybox not working after postback
问题描述
我在asp.net页面上有一个Fancybox(或更准确地说是很多).
我的 Fancybox (jquery插件)可以正常工作,直到页面上发生回发,然后它拒绝工作. /p>
有什么想法吗?任何人都经历过类似的行为吗?
更新:一些代码.
我有一个数据绑定转发器,每个转发项上都有一个花式框.
(在转发器之外)实例化了它们
$(document).ready(function() {
$("a.watchvideo").fancybox({
'overlayShow': false,
'frameWidth' : 480,
'frameHeight' : 400
});
});
重复锚标记.
href =#watchvideo_<%#Eval(" VideoId)%>"
是
的divid="watchvideo_<%#Eval("VideoId") %>
As是实例化Flash电影的脚本元素
是,正在将VideoIds输出到页面上.
更新:闪光灯没有问题.
闪光灯不是问题,因为我尝试过不使用闪光灯,它甚至不会弹出带有简单消息的窗口.
更新:我想知道它是否是更新面板.
-李
它是如上所述的更新"面板
此处..在Ajax更新后,jQuery中的重新绑定事件(updatepanel)
如我所建议,我只是替换了
$(document).ready(function() {
$("a.watchvideo").fancybox({
'overlayShow': false,
'frameWidth' : 480,
'frameHeight' : 400
});
});
与
function pageLoad(sender, args)
{
if(args.get_isPartialLoad())
{
$("a.watchvideo").fancybox({
'overlayShow': false,
'frameWidth' : 480,
'frameHeight' : 400
});
}
}
成功了!
-李
I have a Fancybox (or more accurately) a number of fancy boxes on an asp.net page.
My Fancybox (jquery plugin) works fine until a postback occurs on the page then it refuses to work.
Any thoughts? Anyone experienced similar behaviour?
UPDATE : Some Code..
I have a databound repeater with a fancybox on each repeating item.
They are instanciated by (outside the repeater)
$(document).ready(function() {
$("a.watchvideo").fancybox({
'overlayShow': false,
'frameWidth' : 480,
'frameHeight' : 400
});
});
The anchor tag is repeated..
href="#watchvideo_<%#Eval("VideoId")%>"
As is a div with
id="watchvideo_<%#Eval("VideoId") %>
As is a script element that instanciates the flash movies
Yes the VideoIds are being output the the page.
UPDATE : It's not a problem with the flash..
It is not a problem with the flash as i've tried it without the flash, it wont even pop a window with a simple message in.
UPDATE : I wonder if it is the updatepanel.
Rebinding events in jQuery after Ajax update (updatepanel)
-- lee
It was the Update panel as described
here.. Rebinding events in jQuery after Ajax update (updatepanel)
As suggested I simply replaced
$(document).ready(function() {
$("a.watchvideo").fancybox({
'overlayShow': false,
'frameWidth' : 480,
'frameHeight' : 400
});
});
with
function pageLoad(sender, args)
{
if(args.get_isPartialLoad())
{
$("a.watchvideo").fancybox({
'overlayShow': false,
'frameWidth' : 480,
'frameHeight' : 400
});
}
}
and it worked!
-- Lee
这篇关于回传后,jQuery Fancybox无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!