jQuery PrettyPhoto将ID传递给iframe

Sou*_*aby 5 jquery jquery-plugins

我正在尝试使用jQuery PrettyPhoto,并且由于某种原因它没有通过id变量..如果有人之前遇到过这个问题并且知道解决方案,那就太棒了!这是代码:

<a href="/store-item-details?id=5&iframe=true&width=800&height=530" 
   rel="prettyPhoto[iframes]"
   title="">
   <img src="/images/store/thumbs/'.$item->image.'"
        alt="'.$item->name.'"
        width="100"
        border="0" />
</a>
Run Code Online (Sandbox Code Playgroud)

这是链接(漂亮的照片,点击其中一个缩略图)

http://www.photographicpassions.com/shop?view=products&category=1

这是标签的直接链接:

http://www.photographicpassions.com/store-item-details?id=1&iframe=true&width=800&height=530

请帮忙!:)

and*_*ynu 6

你的问题在于prettyPhoto本身.该插件假定(在iframe情况下)该URL中没有其他重要参数,并在解析出高度和宽度后删除所有这些参数.

这是来自jquery.prettyPhoto.js的未公开版本的片段.注意第三行,它删除movie_url中questionmark之后的所有内容.

    }else if(pp_type == 'iframe'){
      movie_url = $caller.attr('href');
      movie_url = movie_url.substr(0,movie_url.indexOf('?'));

      pp_typeMarkup = '<iframe src ="'+movie_url+'" width="'+(correctSizes['width']-10)+'" height="'+(correctSizes['height']-10)+'" frameborder="no"></iframe>';
    }
Run Code Online (Sandbox Code Playgroud)

我不确定你的感受是多么强悍,但如果你评论出第三行它会对你有用.(你可能想在之后重新缩小看看:http://fmarcia.info/jsmin/test.html)

    }else if(pp_type == 'iframe'){
      movie_url = $caller.attr('href');
      // movie_url = movie_url.substr(0,movie_url.indexOf('?')); // commented out to allow other attributes to be passed along.

      pp_typeMarkup = '<iframe src ="'+movie_url+'" width="'+(correctSizes['width']-10)+'" height="'+(correctSizes['height']-10)+'" frameborder="no"></iframe>';
    }
Run Code Online (Sandbox Code Playgroud)


小智 5

我已经发布了一个新版本的prettyPhoto来修复这个bug,如果你不想破解它的话.

查看项目页面:http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/