diff --git a/20191019/20191019.md b/20191019/20191019.md index 8e9ac8f..a5618b2 100644 --- a/20191019/20191019.md +++ b/20191019/20191019.md @@ -48,4 +48,4 @@ * `™` 商标 * ` ` 半方大的空白 * ` ` 全方大的的空白 - * ` ` 不断行的空 + * ` ` 不断行的空 \ No newline at end of file diff --git a/20191019/buttonSlider.html b/20191019/buttonSlider.html index 61413cc..2883bca 100644 --- a/20191019/buttonSlider.html +++ b/20191019/buttonSlider.html @@ -115,7 +115,6 @@ //向左移动5张图片的距离 点击5次 //... aniamte(ul, target) - } prev.onclick = function() { @@ -137,11 +136,9 @@ clearInterval(ele.timer) ele.timer = setInterval(function(){ var current = ele.offsetLeft - var step = 10; step = target - current >= 0 ? step : - step current += step - if(Math.abs(target - current) > step) { ele.style.left = current + 'px'; } else { diff --git a/20191020/20191020.md b/20191020/20191020.md index e6b0b93..83ad47a 100644 --- a/20191020/20191020.md +++ b/20191020/20191020.md @@ -2,4 +2,11 @@  -* \ No newline at end of file +* 自动轮播图案例 +[linkToHtml](./autoslider.html) + * 自动向左轮播,设置定时器往左挪 + * 为了达到流畅的效果,将第一张复制再最后边,播放完再跳转回第一张 + * 将重复的代码封装成函数 + * 鼠标移入自动停止 + * 鼠标移出自动开始 + \ No newline at end of file diff --git a/20191020/autoSlider.html b/20191020/autoSlider.html new file mode 100644 index 0000000..d7269f6 --- /dev/null +++ b/20191020/autoSlider.html @@ -0,0 +1,116 @@ + + +
+ + + +