Add automatic rotation logic on the basis of jq broadcast diagram.

<script type="text/javascript">
        $(document).ready(function () {
            var blw = $("-sharpmyscrollbox li").width();
            var liArr = $("-sharpmyscrollbox ul").children("li");
            var mysw = $("-sharpmyscroll").width();
            var mus = parseInt(mysw / blw);
            var length = liArr.length - mus;
            var i = 0
            $("-sharpright").click(function () {
                iPP
                if (i < length) {
                    $("-sharpmyscrollbox").css("left", -(blw * i));
                } else {
                    i = length;
                    $("-sharpmyscrollbox").css("left", -(blw * length));
                }
            });
            $("-sharpleft").click(function () {
                i--
                if (i >= 0) {
                    $("-sharpmyscrollbox").css("left", -(blw * i));
                } else {
                    i = 0;
                    $("-sharpmyscrollbox").css("left", 0);

                }
            });
        });
    </script>
<div class="scrollpic">
                <div id="mybtns">
                    <a href="javascript:;" id="left"></a>
                    <a href="javascript:;" id="right"></a>
                </div>
                <div id="myscroll">
                    <div id="myscrollbox">
                        <ul>
                            <li><a href="javascript:;"><img src="img/home1.png" width="200" height="161"><span class="intro">
                                        

111111111111123323131232131

</span></a></li> <li><a href="javascript:;"><img src="img/home2.png" width="200" height="161"><span class="intro">

11111111111111111.

</span></a></li> <li><a href="javascript:;"><img src="img/home3.png" width="200" height="161"><span class="intro">

111111111111111111111111...

</span></a></li> <li><a href="javascript:;"><img src="img/home1.png" width="200" height="161"><span class="intro">

111111111111111111...

</span></a></li> <li><a href="javascript:;"><img src="img/home5.png" width="200" height="161"><span class="intro">

111111111111111111..

</span></a></li> <li><a href="javascript:;"><img src="img/home6.png" width="200" height="161"><span class="intro">

1111111111111111...

</span></a></li> </ul> </div> </div> </div>
The

style is like this

.scrollpic {
    max-width: 1052px;
    max-height: 161px;
    margin: 0 auto;
}
-sharpmyscroll {
    background-color: white;
    bottom: 22px;
    display: block;
    width: 100%;
    position: relative;
    height: 161px;
    overflow: hidden;
}
-sharpmyscroll -sharpmyscrollbox {
    display: block;
    float: left;
    position: absolute;
    left: 0;
    top: 0;
    width: 1000000px;
}
-sharpmyscroll ul {
    display: block;
    float: left;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

-sharpmyscroll ul li {
    display: block;
    float: left;
    padding: 0;
    margin: 0;
}
-sharpmyscroll ul li a {
    display: block;
    float: left;
    width: 200px;
    padding-right:13px;
    position: relative;
    height: 161px;
    color: -sharp333;
}

-sharpmyscroll a .intro {
    position: absolute;
    left: 0;
    z-index: 10;
    background-color: rgba(255, 255, 255, .80);
    /* padding: 0 10px; */
}
-sharpmyscroll a .intro p {
    /* display: flex; */
    text-align: center;
    background-color: -sharpff6700;
    color: white;
    margin: auto;
    width: 200px;
    font-size: 13px;
    line-height: 30px;
    height: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
-sharpmyscroll a .intro {
    bottom: -61px;
}

-sharpmyscroll a:hover .intro {
    bottom: 0px;
}

-sharpmybtns {
    position: relative;
    top: 44%;
    /* margin: 10px; */
    width: 100%;
    display: block;
    z-index: 10;
}
-sharpmybtns -sharpleft{
    width: 15px;
    height: 22px;
    display: block;
    float: left;
}
-sharpmybtns -sharpright{
    width: 15px;
    height: 22px;
    display: block;
    float: right;
}
-sharpmybtns a:hover {
    /* background-color: -sharpd7000f; */
}
-sharpmybtns a:hover,
-sharpmyscroll,
-sharpmybtns a,
-sharpmyscroll a:hover .intro,
-sharpmyscroll a .intro,
-sharpmyscroll -sharpmyscrollbox {
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -ms-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}
-sharpmybtns -sharpleft {
    background-image: url(../img/left.png);
}

-sharpmybtns -sharpright {
    background-image: url(../img/right.png);
}

@media(min-width:1052px) {
    .scrollpic {
        max-width: 1052px;
        width: 100%;
    }

    -sharpmyscroll {
        width: 1052px;
        font-size: 0px;
    }
}

@media(max-width:1052px) {
    .scrollpic {
        max-width: 1052px;
        width: 100%;
    }

    -sharpmyscroll {
        width: 1052px;
        height: 161px;
    }
}

@media(max-width:1052px) {
    .scrollpic {
        max-width: 1052px;
        width: 100%;
    }

    -sharpmyscroll {
        width: 1052px;
    }
}

@media(max-width:1052px) {
    .scrollpic {
        max-width: 786px;
        width: 100%;
    }

    -sharpmyscroll {
        width: 786px;
    }
}
@media(max-width:767px) {
    .scrollpic {
        max-width: 524px;
        width: 100%;
    }

    -sharpmyscroll {
        width: 524px;
    }
}

@media(max-width:523px) {
    .scrollpic {
        max-width: 262px;
        width: 100%;
    }

    -sharpmyscroll {
        width: 200px;
    }
}

clipboard.png

this can only achieve left and right rotation, but not automatic rotation. Ask the boss to teach me how to add the effect of automatic rotation on this basis!

Feb.08,2022

add a setInterval to execute $(right) .trigger ('click'), then add a setTimeout, to clearInterval, in the click event, and then continue to register setInterval after the execution


setInterval(function(){
    iPP
    if (i < length) {
        $("-sharpmyscrollbox").css("left", -(blw * i));
    }else if(i > length){
        i = 0;
        $("-sharpmyscrollbox").css("left", 0);
    }else {
        i = length;
        $("-sharpmyscrollbox").css("left", -(blw * length));
    }
},2000)

judgement of iTun4

<script type="text/javascript">
    $(document).ready(function () {
        var blw = $("-sharpmyscrollbox li").width();
        var liArr = $("-sharpmyscrollbox ul").children("li");
        var mysw = $("-sharpmyscroll").width();
        var mus = parseInt(mysw / blw);
        var length = liArr.length - mus;
        var i = 4;
        $("-sharpright").click(function () {
          if (i<liArr.length-1) {
            iPP;
            $("-sharpmyscrollbox").css("left", -(blw*(i-4)));
          }else {
            i = 4;
            $("-sharpmyscrollbox").css("left", 0);
          }
        });
        $("-sharpleft").click(function () {
            if (i>4) {
              i--;
              $("-sharpmyscrollbox").css("left", -(blw*(i-4)));
            }else {
              i = 4;
              $("-sharpmyscrollbox").css("left", 0);
            }
        });
        setInterval(function(){
          if (i<liArr.length-1) {
            iPP;
            $("-sharpmyscrollbox").css("left", -(blw*(i-4)));
          }else {
            i = 4;
            $("-sharpmyscrollbox").css("left", 0);
          }
        },2000)
    });
</script>

iTun0

$(document).ready(function () {
    var blw = $("-sharpmyscrollbox li").width();
    var liArr = $("-sharpmyscrollbox ul").children("li");
    var mysw = $("-sharpmyscroll").width();
    var mus = parseInt(mysw / blw);
    var length = liArr.length - mus;
    var i = 0;
    var overflow = liArr.length-5;
    var maxi = overflow;
    console.log(overflow,maxi);
    $("-sharpright").click(function () {
        if (i<maxi) {
          iPP;
          $("-sharpmyscrollbox").css("left", -(blw *i));
        }else {
          i = 0;
          $("-sharpmyscrollbox").css("left",0);
        }
    });
    $("-sharpleft").click(function () {
        if (i>0) {
          i--;
          $("-sharpmyscrollbox").css("left", -(blw *i));
        }else {
          i = 0;
          $("-sharpmyscrollbox").css("left",0);
        }
    });
    setInterval(function(){
      if (i<maxi) {
        iPP;
        $("-sharpmyscrollbox").css("left", -(blw *i));
      }else {
        i = 0;
        $("-sharpmyscrollbox").css("left",0);
      }
    },2000)
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cf13-4d9f1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cf13-4d9f1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?