2

livequery で PrettyPhoto を使用する方法を説明できる人はいますか?

  $(document).ready(function()
  {
    $(".gallery a[rel^='prettyPhoto']").livequery(
    function()
    {
      $(this).prettyPhoto({theme:'facebook'});
    });
  });

コードは正しいですが、livequery は PrettyPhoto をサポートしていないと思います。誰か確認できますか?

4

3 に答える 3

6

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-02-04T08:10:11.847 に答える
1
$.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-12-13T05:39:46.060 に答える
0

prrettyPhotoは、rel属性の正規表現を使用してセットを構築するのではなく、写真ごとに1つのギャラリーをインスタンス化します。DOMで新しい初期化を取得するたびに、すべて の初期化を再実行する必要があります。a[rel^='prettyPhoto']これは、prettyPhotoがグローバル変数で設定されている方法によるものmatchedObjectsです。

于 2011-10-11T16:07:23.217 に答える