PrettyPhoto 不适用于 livequery
谁能解释一下如何将 PrettyPhoto 与 livequery 一起使用?
$(document).ready(function()
{
$(".gallery a[rel^='prettyPhoto']").livequery(
function()
{
$(this).prettyPhoto({theme:'facebook'});
});
});
代码是正确的,但我认为 livequery 不支持 PrettyPhoto。有人可以确认吗?
Can anyone explain how to use PrettyPhoto with livequery?
$(document).ready(function()
{
$(".gallery a[rel^='prettyPhoto']").livequery(
function()
{
$(this).prettyPhoto({theme:'facebook'});
});
});
The code is right but I think livequery does not support PrettyPhoto. Can someone confirm?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你在谈论 jQuery 吗?如果是这样,我已经让它工作了:
如果你想加入一些主题或你可以做的事情:
Are you talking about jQuery? If so, I've gotten this to work:
And if you want to put in some theming or something you can do:
发生的情况是 prrettyPhoto 为每张照片实例化一个图库,而不是使用
rel
属性上的正则表达式构建集。您需要做的是,每当您在 DOM 中获得新的内容时,就对所有a[rel^='prettyPhoto']
重新运行初始化。这是由于 PrettyPhoto 是通过全局matchedObjects
变量设置的。WHat happens is that prrettyPhoto instantiates one gallery for each photo rather than building sets using a regexp on the
rel
attribute. What you need to do is re-run the initialization on alla[rel^='prettyPhoto']
whenever you get new ones in your DOM. This is due to the way prettyPhoto is set up with the globalmatchedObjects
var.