Javascript 如何创建推荐滑块

Javascript 如何创建推荐滑块,javascript,jquery,html,slider,Javascript,Jquery,Html,Slider,我必须创建一个滑块插件,用于在网页中显示推荐,推荐项目应该是可见的一次一个,我已经用HTML和jquery创建了基本块。我使用setTimeOut函数在每个函数中隐藏和显示推荐项目,但它不能正常工作。我正在这里粘贴代码 **HTML** <div class="col-md-6 testimonial-wrapper"> <div class="testimonial-item" style="display: block; opaci

我必须创建一个滑块插件,用于在网页中显示推荐,推荐项目应该是可见的一次一个,我已经用HTML和jquery创建了基本块。我使用setTimeOut函数在每个函数中隐藏和显示推荐项目,但它不能正常工作。我正在这里粘贴代码

**HTML**

<div class="col-md-6 testimonial-wrapper">

                    <div class="testimonial-item" style="display: block; opacity: 0.872447;">
                        <h3>
                            Testimonials</h3>
                        <hr style="height: 4px; border: none; color: #333; background-color: #7BC83A;; width: 70px;
                            margin-left: 0;">
                        <h4>
                          Shaf/ Seo</h4>
                        <blockquote>
                            <p>Hi                      
                            </p>
                        </blockquote>
                     </div>

                    <div class="testimonial-item" style="display: block; opacity: 1;">
                        <h3>
                            Testimonials</h3>
                        <hr style="height: 4px; border: none; color: #333; background-color: #7BC83A;; width: 70px;
                            margin-left: 0;">
                        <h4>
                          Shaje/ As</h4>
                        <blockquote>
                            <p>Lorem Ipsum Simply Dummy text Lorem Ipsum Simply Dummy text Lorem Ipsum Simply Dummy text Lorem Ipsum Simply Dummy text                       
                            </p>
                        </blockquote>
                     </div>

           </div>
这不正常


请看那些乱七八糟的代码

我想这就是你想要做的,对吗

$(文档).ready(函数(){
var-estimationalitem=$(“.estimationalwrapper.estimationalitem”);
var lengthOfItem=证明性项目.length;
var计数器=0;
证明项。隐藏();
setTimeout(函数(){
淀粉滴定(计数器);
}, 1000);
功能起始滴定(计数器){
推荐项.eq(计数器).fadeIn('slow',function(){
if(计数器
$(document).ready(function () {

    var wrapper = $(".testimonial-wrapper");
    var testimonialItem = $(".testimonial-wrapper .testimonial-item");
    var timeOut = 10000;
    var lengthOfItem = testimonialItem.length;
    var counter = 0;

    startIteration();



    function startIteration() {
        testimonialItem.each(function () {
            var current = $(this);
            setInterval(startTestimonialSlider(current), timeOut);
            counter++;
            debugger;
            if (counter == lengthOfItem) {
                counter = 0;
                debugger;
                startIteration();
            }

        });

    }

    function startTestimonialSlider(itemToDisplay) {
        itemToDisplay.prev().fadeOut();
        itemToDisplay.fadeIn();
    }

});