小编Ale*_*shy的帖子

Select2标签限制IE浏览器中的输入字符

我尝试在网页中使用最新的select2 v4.0.3库.我在此页面上使用了给定的示例来进行标记和标记化.我在不同的浏览器中测试过它.它工作正常,但在Internet Explorer v.11中它表现得很奇怪:

我试图添加一个不在选项中的新元素.键入几个字符后,光标被带走,我无法完成输入的单词.当我点击选择框以获取光标时,半输入的单词消失了.所以似乎不可能输入超过3-4个字符.在IE中打开它时,我在select2.github.io/examples页面上遇到了相同的情况.

<html>
<head>
    <link rel="stylesheet" href="css/select2.css" type="text/css" />
    <script src="js/jquery-2.1.0.js" type="text/javascript"></script>
    <script src="js/select2.full.js" type="text/javascript"></script>
</head>
<body>
    <script type="text/javascript">
    $(document).ready(function() {
        $(".js-example-tokenizer").select2({
          tags: true,
          tokenSeparators: [',', ' ']
        });
    });
    </script>
    <select class="js-example-tokenizer" multiple="multiple" style="width: 600px;">
      <option value="AL">Alabama</option>
      <option value="WY">Wyoming</option>
    </select>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

不使用标记,select2也可以在IE中正常工作.但我想使用多选标记控件,用户也可以输入自由文本作为选定选项.

是否有一种解决方法可以让select2在IE中使用标记和标记化?

在IE11上用于测试的小提琴示例.

GitHub上的问题涉及到这个问题.

javascript internet-explorer jquery-select2

11
推荐指数
1
解决办法
1170
查看次数

为什么不先移动鼠标就不能滚动过去我的视差?

所以我正在尝试做一个带有视差着陆图片的网页。要使视差效果起作用,它具有更高的高度,因此用户必须向下滚动。这会在侧面创建第二个滚动条,仅用于此视差。到现在为止还挺好。问题是当我向下滚动到视差结束时,第二个滚动条没有自动激活,我必须稍微移动鼠标才能继续滚动网页的正常内容。这是我的问题的一个工作示例:

代码笔

有什么方法可以让它在到达视差结束后继续滚动而不先移动鼠标?

* {
  box-sizing: border-box;
}

html,
body {
  background-color: #fedcc8;
}

.parallax {
  -webkit-perspective: 100px;
  perspective: 100px;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  position: absolute;
  top: 0;
  left: 50%;
  right: 0;
  bottom: 0;
  margin-left: -1500px;
}

.parallax__layer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.parallax__layer img {
  display: block;
  position: absolute;
  bottom: 0;
}

.parallax__cover {
  background: #2d112b;
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 1000px;
  z-index: 2; …
Run Code Online (Sandbox Code Playgroud)

html javascript css scrollbar vue.js

10
推荐指数
1
解决办法
385
查看次数

如何在不同属性比较器的两个对象数组之间获得差异?

我有这两个数组:

主要:

[
   { id: "1"},
   { id: "2"},
   { id: "3"}
]
Run Code Online (Sandbox Code Playgroud)

过滤:

[
   { id: "80", link_id: "1"},
   { id: "50", link_id: null},
   { id: "67", link_id: "3"}
]
Run Code Online (Sandbox Code Playgroud)

我需要获取main其中包含filtered属性的ID 的项目:link_id,我尝试过:

main.filter(x => filtered.includes(x.id));
Run Code Online (Sandbox Code Playgroud)

问题是这将返回null,并且这也不允许我检查是否link_id为null

var main = [{
      id: "1"
    },
    {
      id: "2"
    },
    {
      id: "3"
    }
  ],
  filtered = [{
      id: "80",
      link_id: "1"
    },
    {
      id: "50",
      link_id: null
    },
    {
      id: "67",
      link_id: "3" …
Run Code Online (Sandbox Code Playgroud)

javascript

8
推荐指数
1
解决办法
79
查看次数

将2D阵列转换为树

我正在使用Google Apps脚本,我可以将Google电子表格数据检索为2D数组.我想将此数组转换为树表示,以在Google云端硬盘中构建文件夹层次结构. 在此输入图像描述

这是我可以从Google电子表格中获得的2D数组.

var data =  [
       ["F1", "F1S1","",""],
       ["", "F1S2", "F1S2S1", ""],
       ["", "", "F1S2S2", ""],
       ["", "F1S3", "", ""],
       ["F2", "F2S1", "", ""],
       ["", "F2S2", "F2S2S1", ""],
       ["", "", "F2S2S2", "F2S2S2S1"],
       ["", "", "", "F2S2S2S2"]
    ]
Run Code Online (Sandbox Code Playgroud)

现在我试图把它变成JSON以下.

[
    {
        "name" : "F1",
        "children" : [
            {
                "name" : "F1S1"
            },
            {
                "name" : "F1S2",
                "children" : [
                    {
                        "name" : "F1S2S1"
                    },
                    {
                        "name" : "F1S2S2"
                    }
                ]
            },
            {
                "name" : "F1S3"
            }
        ]
    },
    {
        "name" …
Run Code Online (Sandbox Code Playgroud)

javascript

8
推荐指数
1
解决办法
147
查看次数

woocommerce 小部件“按属性过滤产品”显示不可用的产品

我正在使用WooCommerce 中包含的名为Filter products by attribute小部件。我在 Storefront-child-theme 的类别页面上创建了一个小部件区域functions.php(请参阅下面的代码)。

但是size M,例如,当我按属性过滤时,它会列出 M 码缺货的产品...

知道如何解决这个问题吗?

示例:按尺寸 M 过滤显示此产品,该产品不可用:

在此处输入图片说明

/* FILTER BY SIZE WIDGET */
// Adding the widget area.
if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Below category title',
    'id' => 'extra-widget-area',
    'description' => 'Below category title',
    'before_widget' => '<div class="widget below-cat-title-widget">',
    'after_widget' => '</div>',
    'before_title' => '<h6 class="below-cat-title-widget-title">',
    'after_title' => '</h6>'
    ));
}
// placing the widget
add_action( 'woocommerce_archive_description', 'add_my_widget_area', 31 ); …
Run Code Online (Sandbox Code Playgroud)

html php wordpress jquery woocommerce

8
推荐指数
1
解决办法
2328
查看次数

如何在使用 Nuxt.js 的项目中使用 stencil.js 进行 SSR(也是 SSR)

我想stencil在我的项目中使用一个库nuxt

我能够让它工作,但是当vue组件在服务器端渲染时,我只能使stencil的组件在客户端渲染。

我认为最大的问题是需要defineCustomElement作为window参数。

我知道stencil.js“预渲染”在我的理解中基本上是 SSR,我想使用它以及Nuxt.jsSSR。

所以我的问题是:如何配置一个nuxt项目来支持服务器端渲染stencil.js

javascript server-side-rendering nuxt.js stenciljs

7
推荐指数
1
解决办法
3355
查看次数

将处理消息放在具有现有数据的数据表中的表格顶部?

在我的laravel 5.7应用程序中,我使用"yajra/laravel-datatables-oracle":"~8.0"库并阅读此 https://m.datatables.net/forums/discussion/25666/how-to-customize-the-processing -信息

I modified processing message with style :
.dataTables_processing {
  margin-top: -80px !important;
  padding: 70px !important;
  background: #F5F8FA !important;
  color:    blue !important;
  border: 2px dotted darkgrey;
  border-radius: 3px !important;
  font-size: xx-large !important;
  opacity : 1 !important;
  text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)

它工作,我检查页面打开数据与空数据区域.

但我刷新数据我没有看到处理消息:它在下面(看起来像数据区域的中间).我尝试通过添加上面的样式来提高:

  vertical-align: top;
  vert-align: top;
Run Code Online (Sandbox Code Playgroud)

但失败了.

我数据区的html代码是:

<div class="table-responsive">
   <div id="get-vote-dt-listing-table_wrapper"
        class="dataTables_wrapper no-footer">
      <div id="get-vote-dt-listing-table_filter" class="dataTables_filter"
           style="display: none;"><label>Search:<input type="search" class=""
                                                       placeholder=""
                                                       aria-controls="get-vote-dt-listing-table"></label>
      </div>
      <div id="get-vote-dt-listing-table_processing"
           class="dataTables_processing" style="display: block;">Loading
         votes...
      </div>
      <table class="table table-bordered table-striped text-primary dataTable no-footer" …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery datatables

7
推荐指数
1
解决办法
462
查看次数

使用TABS时,DataTable.js无法正确加载

我使用DataTables.js生成表.它很棒,工作正常.我想将Tabs添加到我的"页面"中,但似乎当DataTables在主要选项卡上使用时,它不会加载所有内容.

  • 第一个标签 在此输入图像描述

  • 第二个标签 在此输入图像描述

以下是添加了DataTable的一个列/卡的源代码.

    <div class="three defaultColumn defaultCard">
                            <script>
                                $(document).ready(function() {
                                    $("#DT-iuyx2s7b").DataTable({
                                        dom: "Bfrtip",
                                        buttons: [
                                            "copyHtml5",
                                            "excelHtml5",
                                            "csvHtml5",
                                            "pdfHtml5"
                                        ],
                                        colReorder: true,
                                        paging: true,
                                        pagingType: ["full_numbers"],
                                        lengthMenu: [
                                            [15, 25, 50, 100],
                                            -1,
                                            [15, 25, 50, 100],
                                            "All"
                                        ],
                                        ordering: true,
                                        info: true,
                                        procesing: true,
                                        responsive: {
                                            details: true
                                        },
                                        select: true,
                                        searching: true,
                                        stateSave: true
                                    });
                                });
                            </script>
                            <table id="DT-iuyx2s7b" class="display compact">
                                <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Id</th>
                                        <th>PriorityClass</th>
                                        <th>FileVersion</th>
                                        <th>HandleCount</th>
                                        <th>WorkingSet</th>
                                        <th>PagedMemorySize</th>
                                        <th>PrivateMemorySize</th>
                                        <th>VirtualMemorySize</th>
                                        <th>TotalProcessorTime</th>
                                        <th>SI</th>
                                        <th>Handles</th>
                                        <th>VM</th>
                                        <th>WS</th> …
Run Code Online (Sandbox Code Playgroud)

html javascript css datatables

7
推荐指数
1
解决办法
475
查看次数

SwaggerUIBundle 隐藏方案

我正在研究swagger-ui使用 swaggerjson文件的文件,例如:

...
...
...
host: example.com
basePath: /
schemes:
- https
swagger: "2.0"
...
...
...
Run Code Online (Sandbox Code Playgroud)

有什么方法可以不schemes通过swagger-ui.

我已经浏览了配置文档,但找不到任何我可以使用的东西。我可能会遗漏一些东西。

如果您有任何想法,请告诉我。

我的JS代码片段:

// above code for swagger-ui stuff
// snippet is just about conf
jQuery(document).ready(function () {
    const swaggerUI = SwaggerUIBundle({
        url: jQuery("#swagger-ui").data("source"),
        dom_id: "#swagger-ui",
        deepLinking: true,
        presets: [
        SwaggerUIBundle.presets.apis
        ],
        plugins: [
        ],
        layout: "BaseLayout",
        defaultModelsExpandDepth: -1,
    });
    window.swaggerUI = swaggerUI;
});
Run Code Online (Sandbox Code Playgroud)

我想隐藏的内容:

在此处输入图片说明

javascript swagger swagger-ui swagger-2.0

7
推荐指数
1
解决办法
743
查看次数

为什么 bootstrap 4 滑块工作不顺畅?

我有自定义bootstrap4滑块是工作,但没有平滑当我点击nextprev按钮,滑块是突然而不是顺利。我怎么能做到这一点,你有什么想法可以解决这个问题吗?

下面给出的滑块:-

$('.carousel-item', '.multi-item-carousel').each(function() {
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));
}).each(function() {
  var prev = $(this).prev();
  if (!prev.length) {
    prev = $(this).siblings(':last');
  }
  prev.children(':nth-last-child(2)').clone().prependTo($(this));
});
Run Code Online (Sandbox Code Playgroud)
.multi-item-carousel {
  overflow: hidden;
}

.multi-item-carousel .carousel-indicators {
  margin-right: 25%;
  margin-left: 25%;
}

.multi-item-carousel .carousel-control-prev,
.multi-item-carousel .carousel-control-next {
  /* background: rgba(255, 255, 255, 0.3); */
  width: 25%;
  z-index: 11;
  /* .carousel-caption has z-index 10 */
}

.multi-item-carousel .carousel-inner {
  width: 240%;
  left: -70%;
} …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery bootstrap-4

7
推荐指数
1
解决办法
1281
查看次数