光滑的滑块使启动延迟

时间:2019-03-29 06:20:20

标签: javascript jquery

是否可能使滑块启动延迟...我不想立即启动滑块,希望它在启动之前先等待2秒钟,然后再滑动。

import json
features = data["features"]
point_handle_text = {
    i["properties"]["EntityHandle"]: i["properties"]["Text"]
    for i in features
    if i["geometry"]["type"] == "Point"
}
point_handle_area = {
    i["properties"]["EntityHandle"]: i["properties"]["Area"]
    for i in features
    if i["geometry"]["type"] == "Point"
}
combine_features = []
for i in features:
    if i["geometry"]["type"] == "LineString":
        i["properties"]["Text"] = point_handle_text.get(i["properties"]["EntityHandle"])
        combine_features.append(i)
data["features"] = combine_features

combine_features = []
for i in features:
    if i["geometry"]["type"] == "LineString":
        i["properties"]["Area"] = point_handle_area.get(i["properties"]["EntityHandle"])
        combine_features.append(i)
data["features"] = combine_features

with open('test.geojson', 'w+') as f:
    json.dump(data, f, indent=2)

2 个答案:

答案 0 :(得分:0)

通过speed:2000,autoplaySpeed:2000,来控制速度,这将根据给定的时间延迟滑块

答案 1 :(得分:0)

如果您希望在初始页面加载时使用此功能,只需使用setTimeout()函数,

var count = 0;
    setTimeout(()=>{
        count = 1;
        $('.banner').slick({
          autoplay:true,
          autoplaySpeed:2000,
          centerMode: true,
          centerPadding: '50px',
          slidesToShow: 1,
          speed:2000,
          pauseOnFocus: false,
          pauseOnHover: false,
          pauseOnDotsHover: false,

    },2000) // Initialize the amount of time to delay , Its 2seconds currently.

if(count == 1){
 $(function() {
        $('.banner').slick({
          autoplay:true,
          autoplaySpeed:2000,
          centerMode: true,
          centerPadding: '50px',
          slidesToShow: 1,
          speed:2000,
          pauseOnFocus: false,
          pauseOnHover: false,
          pauseOnDotsHover: false,
        });
      }