为了账号安全,请及时绑定邮箱和手机立即绑定

Failed to load resource: the server responded with a status of 404 (Not Found)的问题怎么解决呢

这是我的代码,js文件和css样式都是能用的,console.log里的内容都能输出,所以autoPlay函数是能够运行的,实在想不到是哪里的资源没下下来。(而且上一个课程的走马灯我也是能跑出来的)

```

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

<script>

    $(()=>{

        console.log('页面元素加载完执行');

        var outerWidth = 600,

            outerHeight = 400,

            speed = 3,

            transitionTime = .3,

            initIndex = 0,

            setTimeId = null;

        var $marquee=$('.marquee');

        var $content=$marquee.find('.content');

        var $list=$content.find('.list');

        var listLength = $list.length;//list的长度之和就是content的宽度

        var contentWidth = outerWidth*listLength;//outerWidth就是之前所设置的list的宽度

        var style = document.styleSheets;//获得页面加载的样式表

        $marquee.css({

            "width":`${outerWidth}px`,

            "height":`${outerHeight}px`

        });

        $list.css({//content需要list来算

            "width":`${outerWidth}px`,

            "height":`${outerHeight}px`

        });

        $content.css({//content需要list来算

            "width":`${contentWidth}px`,

            "height":`${outerHeight}px`,

        });

        var clone = $list.eq(0).clone();//选择list列表里的第一个元素把它克隆下来放到content里面

        $content.append(clone);

        function autoPlay(){

            console.log('函数开始');

            initIndex++;

            setTimeId = setInterval(()=>{

                $content.css({

                    "transition":`transform ${transitionTime}s ease`,

                    "transform":`tanslateX(-${initIndex*outerWidth}px)`

                })

            },speed*1000)

            console.log('函数末端');

        }

        autoPlay()

    })

</script>

```


正在回答

2 回答

举报

0/150
提交
取消

Failed to load resource: the server responded with a status of 404 (Not Found)的问题怎么解决呢

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信