快捷导航

Uncaught TypeError: Cannot read property 'style' of null


window.onload = function(){
        banner();
        backTime();
        topnews();
}
/* 轮播图 */
var banner = function(){
        //获取到轮播相关的DOM元素
        var banner = document.querySelector('.banner');
        var imgBox = banner.querySelector('.imgBox');
        var pointBox = banner.querySelector('.pointBox');
        var lis = pointBox.querySelectorAll('li');
        //定义初始变量
        var index = 1;
        var bwidth = banner.offsetWidth;
        /* 开始图片轮播 */
        var timer = setInterval(function(){
                index++;
                imgBox.style.transition = 'all 0.5s';
                imgBox.style.transform = 'translateX('+ -index*bwidth +'px)';
        },1000);
        /* 图片切换过度之后 */
        imgBox.addEventListener('transitionend',function(){
                if(index>8){
                        index = 1;
                        imgBox.style.transition = 'none';
                        imgBox.style.transform = 'translateX('+ -index*bwidth +'px)';

                }else if(index

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP