【问题标题】:Dropdown list is bottom of the site下拉列表是网站的底部
【发布时间】:2017-01-19 11:37:17
【问题描述】:

我的 select2 显示有一点问题。 请求完美运行,我有正确的项目,问题不在这里,问题是列表完全位于站点底部(在页脚之后)。

代码是:

<input type="hidden" class="select2 form-control" id="select2" placeholder="search ..." name="q" value="{{ searchTerm ?: '' }}"> 

和:

<script type="text/javascript">
    function format(product) {
        return '<img src="/media/images/'+product.image+'" alt="" class="imgmedia-object" height="60" width="60"/><h5>'+product.name</h5><hr>';
    }

    $(document).ready(function() {

        // Get this orders sku
        var skus = [];
        $('.sku').each(function(){
            skus.push($(this).text().trim());
        });

        $(".select2").select2({
            multiple: true,
            minimumInputLength: 2,
            tokenSeparators: [',', ' '],
            ajax: {
                url: "{{ url('sylius_backend_product_find') }}",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        criteria: {
                            sku: term
                        }
                    };
                },
                results: function (data, page) {
                    return {
                        results: data
                    };
                }
            },
            formatResult: format
        }).on("select2-selecting", function(e) {
            window.location = e.choice.url;
        });

    });
</script>

我在搜索字词时收到警告:

此站点似乎使用了滚动链接的定位效果。这可能不适用于异步平移;请参阅https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects 了解更多详情并加入有关相关工具和功能的讨论!

问题可能来自警告,但我不知道如何解决。

提前谢谢

【问题讨论】:

    标签: javascript symfony jquery-select2 sylius


    【解决方案1】:

    只是因为我没有添加 'bundles/syliusweb/css/select2.css' 行...

    【讨论】:

      猜你喜欢
      • 2013-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-24
      • 2022-01-04
      • 1970-01-01
      相关资源
      最近更新 更多