有人能解释一下如何在livequery中使用PrettyPhoto吗?
$(document).ready(function()
{
$(".gallery a[rel^='prettyPhoto']").livequery(
function()
{
$(this).prettyPhoto({theme:'facebook'});
});
});代码是正确的,但我认为livequery不支持PrettyPhoto。有人能确认一下吗?
发布于 2011-02-04 16:10:12
你是在说jQuery吗?如果是这样的话,我已经让它工作了:
$("a[rel=prettyPhoto]").live("click",function() {
$.prettyPhoto.open($(this).attr("href"),"","");
return false;
});如果你想加入一些主题或者其他东西,你可以这样做:
$.fn.prettyPhoto({'theme': 'light_rounded'});
$("a[rel=prettyPhoto]").live("click",function() {
$.prettyPhoto.open($(this).attr("href"),"","");
return false;
});发布于 2011-12-13 13:39:46
$.fn.prettyPhoto({
animation_speed: 'fast', /* fast/slow/normal */
slideshow: 5000, /* false OR interval time in ms */
theme: 'facebook' /* light_rounded / dark_rounded / light_square / dark_square / facebook /pp_default*/
});
$.prettyPhoto.open('xzs.html?iframe=true&width=100%&height=100%','Title','DESC');
User
<a style="color: #F99;text-decoration:inherit;" href="javascript:;" rel="prettyPhoto[iframes]" name="xzs.html?iframe=true&width=100%&height=100%" title="test">test</a>
$("a[rel^='prettyPhoto']").livequery(function(){
var url = $(this).attr(name);
$.prettyPhoto.open(url,'Title','DESC');
});发布于 2011-10-12 00:07:23
prrettyPhoto会为每张照片实例化一个图库,而不是使用rel属性上的WHat构建集。每当在DOM中获得新的a[rel^='prettyPhoto']时,您需要做的就是在所有DOM上重新运行初始化。这是由于使用全局matchedObjects变量设置prettyPhoto的方式造成的。
https://stackoverflow.com/questions/2374558
复制相似问题