Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使滑块连续循环_Javascript_Jquery_Css - Fatal编程技术网

Javascript 如何使滑块连续循环

Javascript 如何使滑块连续循环,javascript,jquery,css,Javascript,Jquery,Css,我使用此jquery代码使我的推荐部分正常工作: $(document).ready(function () { var testimonialItem = $(".testimonial-wrapper .testimonial-item"); var lengthOfItem = testimonialItem.length; var counter = 0; testimonialItem.hide(); setTimeout(function(){ sta

我使用此jquery代码使我的推荐部分正常工作:

$(document).ready(function () {
  var testimonialItem = $(".testimonial-wrapper .testimonial-item");
  var lengthOfItem = testimonialItem.length;
  var counter = 0;  
  testimonialItem.hide();
  setTimeout(function(){
    startIteration(counter);
  }, 1000);
  function startIteration(counter) {
    testimonialItem.eq(counter).fadeIn('slow', function() {
      if(counter<=lengthOfItem){ 
        setTimeout(function(){ 
        testimonialItem.fadeOut('slow',function(){
        if (counter == lengthOfItem) {
            counter = 0;  
        }
        else{
            counter++;
        }
        setTimeout(function(){ 
            startIteration(counter);
        }, 500);    
        });
        }, 2000);
      }
    });
  }
});
$(文档).ready(函数(){
var-estimationalitem=$(“.estimationalwrapper.estimationalitem”);
var lengthOfItem=证明性项目.length;
var计数器=0;
证明项。隐藏();
setTimeout(函数(){
淀粉滴定(计数器);
}, 1000);
功能起始滴定(计数器){
推荐项.eq(计数器).fadeIn('slow',function(){

如果(counter老实说,我不能说我已经解决了任何问题。我想你可能会遇到其他一些长期计时的问题,但我的谷歌搜索没有发现任何问题

$(document).ready(function () {
  var testimonialItem = $(".testimonial-wrapper .testimonial-item");
  var lengthOfItem = testimonialItem.length;
  testimonialItem.hide();

  setTimeout(startIteration.bind(0), 1000);

  function startIteration(counter) {
    var item = testimonialItem.eq(counter)
    item.fadeIn('slow', function() {
      setTimeout(function() { 
        item.fadeOut('slow', function() {
          startIteration((counter + 1) %  lengthOfItem);  
        });
      }, 2000);
    });
  }
});
您可以使用
.queue()
.delay()
.promise()
.then()
,在队列数组不包含任何其他要调用的函数时重复调度调用同一函数

var items=$(“.commential item”).hide();
功能鉴定书(){
返回$({}).queue(“推荐信”),$.map(项,函数(el){
返回函数(下一步){
$(el).fadeIn(“慢”,函数(){
$(此).延迟(2000).淡出(“慢”,下一个)
})
}
})).退出(“证明”).承诺(“证明”)
.然后(推荐)
}
推荐信()
hr{
高度:4px;
边界:无;
颜色:#333;
背景色:#7BC83A;
宽度:70px;
左边距:0;
}
.证明项目{
显示:块;
不透明度:0.872447;
}

推荐书

高级工程师/高级工程师 嗨

推荐书
沙耶/阿斯 Lorem Ipsum简单虚拟文本Lorem Ipsum简单虚拟文本Lorem Ipsum简单虚拟文本Lorem Ipsum简单虚拟文本Lorem Ipsum简单虚拟文本


您可以用
替换.then(function(){setTimeout(esticiousal,500)})
替换
。then(esticiousal)
如果您想将下一次调用
推荐信的时间延迟
500
毫秒,那么它似乎可以正常工作。有没有办法从您的代码中删除项目符号导航?知道这不是主要问题,但如果您也能提供支持,我们将不胜感激。@WosleyAlarico“有没有办法从你的代码中查看子弹导航?”不确定你的意思。“子弹”是什么?只是编辑了我的问题,以便你可以看到图像exampled@WosleyAlarico这是一个完全不同的问题,不是吗