• 文字跳动


    <!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>
  • 相关阅读:
    如何将asp.net MVC2项目升级为MVC3项目(微软官方自动升级工具:ASP.NET MVC 3 Application Upgrader )
    扩展Html Helper类,ASP.NET MVC框架提供了一个帮助我们构造Html元素的类:TagBuilder
    详解ASP.NET MVC2项目升级到MVC 3 RC
    NHibernate学习
    ASP.MVCNOTE
    MVC问题反馈页面代码
    Silverlightnote
    jqGrid
    必须掌握的八个DOS命令
    分页且带条件的存储过程
  • 原文地址:https://www.cnblogs.com/zzh965390267/p/8677600.html
Copyright © 2020-2023  润新知