首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Prettyphoto和Rails

Prettyphoto和Rails
EN

Stack Overflow用户
提问于 2012-08-26 11:28:39
回答 1查看 339关注 0票数 0

我正在尝试让漂亮的照片在我的rails应用程序中工作。我想有一个由回形针宝石上传的漂亮照片中的图像显示。

我运行的是rails 3.2.8,回形针3.1.4和hiq5/prettyphoto rails gem。

这是我在正文末尾的内容:

代码语言:javascript
复制
<script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
        $("a[rel^='prettyPhoto']").prettyPhoto({
            animationSpeed: 'normal', /* fast/slow/normal */
            padding: 40, /* padding for each side of the picture */
            opacity: 0.35, /* Value betwee 0 and 1 */
            showTitle: false, /* true/false */
            allowresize: true, /* true/false */
            counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
            theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
        });
    });
</script>

下面是rails的link_to:

代码语言:javascript
复制
<%= link_to image_tag(@client.price_plan.flier1.url(:small)), @client.price_plan.flier1.url(:medium), rel: "prettyPhoto" %>

我认为问题可能是回形针与尾部的字符串创建的链接?

示例:

代码语言:javascript
复制
http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg?1345698254

漂亮的照片需要去掉1345698254的链接才能工作吗?

示例:

代码语言:javascript
复制
http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg

如果是这样,我怎样才能在回形针中做到这一点呢?

谢谢,

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-27 12:55:59

我最终回到了这个问题上,并能够用当前版本解决它。这可能是一个bug,但我发现通过设置rel:'prettyPhoto‘不起作用,rel:"prettyPhoto“起作用?

最终的链接看起来像这样:

代码语言:javascript
复制
<%= link_to "PrettyPhoto test", @client.price_plan.flier1.url(:medium), rel: "prettyPhoto", class: "prettyphoto" %>

希望这能帮助其他人……

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

https://stackoverflow.com/questions/12127406

复制
相关文章

相似问题

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