简体   繁体   English

Javascript未加载-rails-Spree Commerce

[英]Javascript not loading -rails - spree commerce

I'm messing around with Spree commerce trying to learn it. 我搞砸了Spree Commerce,试图学习它。 I downloaded an HTML theme ( http://themeforest.net/item/convertible-responsive-html5-template/full_screen_preview/6289591 ) and I'm just trying to have that as the front end of the site. 我下载了HTML主题( http://themeforest.net/item/convertible-sensitive-html5-template/full_screen_preview/6289591 ),而我只是想将其作为网站的前端。 Not the actual store. 不是实际的商店。

The store is mounted at /store while this template is going to be the static pages. 当此模板将成为静态页面时,将商店安装在/ store上。

I'm not sure if it's because of the templates, rails 4 turbolinks, spree commerce and how it messes the setup of a rails app. 我不确定是否是因为模板,Rails 4 Turbolinks,疯狂的商务以及它如何影响Rails应用程序的设置。 I've been trying everything for the past 3 days and I've looked/tried every fix I could find and it's still not working. 在过去的3天里,我一直在尝试所有操作,并且已经查找/尝试了所有可以找到的修复程序,但该修复程序仍然无法正常工作。

Below is the code for the slider part of the homepage. 以下是主页滑块部分的代码。 It's literally the same as the theme above. 它实际上与上面的主题相同。 It's a flexslider. 这是一个flexslider。 Here's the js (which I have the same file in: app/assets/javascripts in my rails app 这是js(我在Rails应用中的app / assets / javascripts中有相同的文件

https://github.com/werein/flexslider-rails/blob/master/vendor/assets/javascripts/jquery.flexslider.js https://github.com/werein/flexslider-rails/blob/master/vendor/assets/javascripts/jquery.flexslider.js

Home slider: 主页滑块:

    <!-- home 
        ================================================== -->
    <div class="section">
        <div id="home-section">
            <div class="home-box">
                <%= image_tag "upload/singlepage-bg.jpg", :class => "background-view"  %>
                <div class="slider-caption">
                    <div class="container">
                        <div class="flexslider">
                             <ul class="slides">
                                <li>
                                    <p class="flex-caption">Convertible <span>is great</span> template</p>
                                </li>
                                <li>
                                    <p class="flex-caption">We are great <span>company</span></p>
                                </li>
                                <li>
                                    <p class="flex-caption">We <span>support</span> you</p>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>              
            </div>
        </div>
    </div>


    <!-- End home -->

Beginning of JS file: jquery.flexslider.js JS文件的开头:jquery.flexslider.js

;(function ($) {

  //FlexSlider: Object Instance
  $.flexslider = function(el, options) {
    var slider = $(el),
      vars = $.extend({}, $.flexslider.defaults, options),
      namespace = vars.namespace,
      touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof     DocumentTouch,
    eventType = (touch) ? "touchend" : "click",
    vertical = vars.direction === "vertical",
    reverse = vars.reverse,
    carousel = (vars.itemWidth > 0),
    fade = vars.animation === "fade",
    asNav = vars.asNavFor !== "",
    methods = {};

It looks like you have to use deface otherwise it won't work. 看来您必须使用污损,否则将无法使用。 I found out from a rails developer with experience in spree on a google helpout 我从Rails开发人员那里发现了对Google Helpout的狂热体验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM