简体   繁体   English

Rails:jQuery-ui-Slider-Pips:错误:slider 小部件实例没有这样的方法'pips'

[英]Rails: jQuery-ui-Slider-Pips: Error: no such method 'pips' for slider widget instance

Using the plugin from -> http://simeydotme.github.io/jQuery-ui-Slider-Pips/#getting-started Even though the slider loads, no Pips get loaded.使用来自 -> http://simeydotme.github.io/jQuery-ui-Slider-Pips/#getting-started的插件即使加载了 Z10BF08F0BBD6689475BE65B4AE441BD9,也没有加载 Pips。

Rails 5 with JQuery带有 JQuery 的导轨 5

1: Downloaded  jquery-ui-slider-pips.css under myApp/app/assets/stylesheets

2: Downloaded jquery-ui-slider-pips.js under myApp/app/assets/javascripts

3: application.js 

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery-ui-slider-pips

4: application.css

 *= require jquery-ui-slider-pips

5: In the View
    <!-- include the jQuery and jQuery UI scripts -->
    <script src="https://code.jquery.com/jquery-2.1.1.js"></script>
    <script src="https://code.jquery.com/ui/1.11.1/jquery-ui.js"></script>

    <!-- plus a jQuery UI theme, here I use "flick" -->
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/flick/jquery-ui.css">

<div class="slider"></div>

<script type="text/javascript">
 $(function () {

    $(".slider")
        .slider({
            max: 12
        })
        .slider("pips", {
            rest: "label"
        });
 });
</script>

The slider loads with no pips and Error: no such method 'pips' for slider widget instance in browser console. slider 加载时没有点和错误:浏览器控制台中的 slider 小部件实例没有此类方法“点”。 Can anyone please help?有人可以帮忙吗?

I think you need to add;我认为您需要添加;

<script src="/path/to/jquery-ui-slider-pips.js"></script>

to your "view"... I don't know rails at all, so I'm taking a leap here.到你的“观点”......我根本不知道轨道,所以我在这里飞跃。

Alternatively you can use the official source:或者,您可以使用官方来源:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-ui-Slider-Pips/1.11.4/jquery-ui-slider-pips.js"></script>

But I do recognise that I've missed a crucial step in the docs which has the effect of making it seem unnecessary!但我确实认识到我错过了文档中的一个关键步骤,这使得它看起来没有必要! I'll update as soon as I can我会尽快更新

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

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