首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >jQuery: PrettyPhoto API不工作

jQuery: PrettyPhoto API不工作
EN

Stack Overflow用户
提问于 2010-11-24 19:11:20
回答 1查看 11K关注 0票数 19

我正在尝试使用firebug API,但是firebug说$.prettyPhoto.open()不是一个函数,因此无法工作……

代码:http://jsbin.com/ihuje3/3/edit

$(document).ready(function(){
     $.prettyPhoto.open('http://www.microdual.com/assets/images/newsletters/doublehosting.jpg','Test','Test desc');
});
​
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-11-24 20:11:49

您必须首先设置prettyPhoto (不幸的是,由于插件的编写方式),如下所示:

$(document).ready(function(){
  $.fn.prettyPhoto(); //usually $("a[rel^='prettyPhoto']").prettyPhoto();
  $.prettyPhoto.open('http://www.microdual.com/assets/images/newsletters/doublehosting.jpg','Test','Test desc');
});

$.prettyPhoto.open()这样的函数是通过运行`$来定义的You can see in the source

另一个问题是这个插件在jQuery 1.4.4中引入的调用者上下文似乎有问题,它在1.4.3 (you can test it here)中工作得很好。This has been reported on the forums,希望作者能尽快解决这个问题。​

票数 41
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4266097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档