Pinterest 克隆我正在构建。Rails 应用程序 4.1.4。
.
当您从索引页面单击 Pin 时,它会显示页面。
SHOW 页面有一些JavaScript可以调整图片/ DIV 的大小。
.
几乎每次我从索引页面单击 Pin 时,javascript 都不会运行(不会调整图像/div 的大小)。
但是,如果我使用 Web 浏览器单击“刷新”,脚本似乎总是运行得很好(图像/Div 的大小调整得很好)。
.
github上js链接: https : //github.com/growthcode/pinterest/blob/master/app/assets/javascripts/pins.js.coffee
在 Heroku 上尝试一下: https : //growthcode-pinterest.herokuapp.com/
.
SHOW 引脚的 html:
<div class="container">
<div class="row">
<div id="showPinContainer" class="col-xs-12">
<div id="showPin" class="well">
<%= image_tag @pin.image, class: "show-image" %>
<p class="description"><%= @pin.description %></p>
<p><%= @pin.user.name %></p>
<% if current_user == @pin.user %>
<%= link_to 'Edit', edit_pin_path(@pin) …Run Code Online (Sandbox Code Playgroud)