zoukankan      html  css  js  c++  java
  • 文字跳动

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    #jump{
    margin-top: 400px;
    }
    span{
    cursor: pointer;
    position: relative;
    top:0px;
    font-size: 20px;
    display: inline-block;
    /* animation: rotate 1s 1 ; */
    transition: all 1s;
    }
    @keyframes rotate {
    from{transform: rotateZ(0deg)}
    to{transform: rotateZ(360deg)}
    }
    .active{
    animation: rotate 1s 1;
    }
    /* span:hover{
    top:-60px;
    animation:rotate 1s ;
    } */
    </style>
    </head>
    <body>
    <div id='jump'>摸我我就要跳啦呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀
    呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀</div>
    <script>
    var jump=document.getElementById('jump');
    jjj()
    function jjj(){
    var font= jump.innerText;
    jump.innerText=''
     
    for(var i=0;i<font.length;i++){
    var node= document.createElement('span');
    // node.style.transition='all 0s '
    node.innerHTML=font[i];
    // node.onmouseover=function(){
    // node.style.top='-60px';
    // node.style.transition='all 1s'
    // }
    // node.onmouseout=function(){
    // node.style.top='0px';
    // }
    jump.appendChild(node)
    }

    var allspan=document.getElementsByTagName('span');

    for(let j=0;j<allspan.length;j++){

    allspan[j].onmouseenter=function(){
    console.log(j)
     
    allspan[j].style.transition='all 0s'
    allspan[j].style.top='-50px';
    allspan[j].className='active'
    }
    allspan[j].onmouseleave=function(){
    setTimeout(()=>{
    allspan[j].className=''
    },1000)
     
    allspan[j].style.top='0px';
    allspan[j].style.transition='all 1s'
    }

    }

     
    }
    </script>
    </body>
    </html>
  • 相关阅读:
    JDBC 复习4 批量执行SQL
    JDBC 复习3 存取Oracle大数据 clob blob
    Oracle复习
    Linux命令(1)grep
    JDBC 复习2 存取mysql 大数据
    JDBC 复习1 DBUtil
    php 环境搭建问题
    Windows 批处理 bat 开启 WiFi 菜单选项 设置ID PWD
    Bat 批处理启动和停止Oracle 服务
    docker 学习1 WSL docker ,Windows docker
  • 原文地址:https://www.cnblogs.com/zzh965390267/p/8677600.html
Copyright © 2011-2022 走看看