zoukankan      html  css  js  c++  java
  • 移动端轮播图

    1)概况

    //和PC端基本一样

    //1 可以自动播放图片
    //2 手指可以拖动播放

    一  图片自动播放

    1)自动播放

    //1 开启定时器
    //2 用translate移动
    //3 让图片优雅的移动 添加transition过渡

    2)无缝滚动

    3)让小圆点跟着一起变化

    二 classList属性

    1)概念

    是H5新增的一个属性

    用于 添加 删除 切换CSS类






    返回值

    返回一个数组
    DOMTokenList(3) ["one", "two", "three", value: "one two three"] 0: "one" 1: "two" 2: "three" length: 3 value: "one two three" __proto__: DOMTokenList
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport"
    content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>classList</title>
    <style>
    .red { background: black; }
    </style>
    </head>
    <body>
    <div class="one two three"></div>
    <button>开关灯</button>
    <script>
    var div = document.querySelector('div');
    var btn = document.querySelector('button');
    //1 获取类名
    console.log(div.classList);//返回一个数组
    console.log(div.classList[0]);//取得第一个元素

    //2 添加类名 是追加的形式 不会覆盖前面的
    div.classList.add('five');

    //3 删除类名
    div.classList.remove('five');

    //4 toggle 切换类名 [如果有 我删除 如果没有 我添加]
    btn.onclick = function(){
    document.body.classList.toggle('red');
    }
    </script>
    </body>
    </html>

    2)页面布局

    对应的页面结构

      

     

  • 相关阅读:
    archlinux .bash_history
    Ubuntu环境下挂载新硬盘
    软碟通 UltraISO U启替代品 Win32DiskImager 无设备 无盘符 无u盘 无优盘 解决方案 之diskpart
    delphi Integer overflow
    MSBuild Tools offline
    delphi synedit免费的拼写检查器dll
    git 自定义命令行
    lua编译
    gcc ar
    Windows Subsystem for Linux (WSL)挂载移动硬盘U盘 卸载 c d 盘
  • 原文地址:https://www.cnblogs.com/fuyunlin/p/14475035.html
Copyright © 2011-2022 走看看