前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >sao气十足的网页特效,让你的网页“动”起来

sao气十足的网页特效,让你的网页“动”起来

作者头像
程序员老鱼
发布2022-12-02 10:24:52
7280
发布2022-12-02 10:24:52
举报
文章被收录于专栏:前端实验室

大家好,我是前端实验室的大师兄!

不知道大家在浏览网站和博客的时候有没有见到过非常有意思的页面特效呢?今天大师兄就带给大家几个有趣的特效,而且不用写代码,引入就能使用

看板娘

引入方式

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>看板娘</title>
</head>
<body>
    <!-- 看板娘 -->
    <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css" />
    <script src="https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/autoload.js"></script>
</body>
</html>

猫咪返回顶部

使用方式

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="zh">

<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>返回顶部</title>
    <link rel="stylesheet" type="text/css" href="http://zhouql.vip/cdn/css/szgotop.css" />
</head>

<body style="height: 2000px;">
    <div class="back-to-top cd-top faa-float animated cd-is-visible" style="top: -900px;"></div>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <script src="http://zhouql.vip/cdn/szgotop.js"></script> 
</body>
</html>

点击爆炸

代码语言:javascript
复制
<!--给网站添加鼠标点击爆炸五颜六色特效-->
<script src="http://zhouql.vip/cdn/blast.js"></script>

鼠标点击自定义文字

引入JQuery

代码语言:javascript
复制
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>

引入JS

代码语言:javascript
复制
<script src="http://zhouql.vip/cdn/click1.js"></script> 

添加方式

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        div {
            height: 100vh;
        }
    </style>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>
<body style="width: 100%;height: 100%;">
    <div></div>
    <script src="http://zhouql.vip/cdn/click1.js"></script> 
</body>
</html>

樱花飘落

引入方式

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>樱花特效</title>
</head>

<body>
    <script type="text/javascript"
        src="https://cdn.jsdelivr.net/gh/Fuukei/Public_Repository@latest/static/js/sakura-less.js"></script>
</body>
</html>

掘金登录

代码

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>掘金登录小案例</title>
    <!-- bootstrap4图标库引入 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
    <!-- css文件引入 -->
    <link rel="stylesheet" href="./index.css">
    <!-- 网站图标 -->
    <link rel="shortcut icon" href="http://zhouql.vip/images/tou/t1.png" type="image/x-icon">
</head>

<body>
    <div id="app">
        <form action="" method="get">
            <button></button>
            <h2>手机登录</h2>
            <p><input type="text" name="" autofocus id="phone" placeholder="请输入手机号"></p>
            <p><input type="password" name="" id="pwd" placeholder="验证码"></p>
            <p><input type="submit" value="登录"></p>
            <a href="">其他登录方式</a>
            <p><span>注册登录即表示同意 <small>用户协议,隐私政策</small></span></p>
        </form>
        <img class="t1" src="./images/4f6f6f316cde4398d201cd67e44ddea3.svg" alt="">
        <img class="t2" src="./images/500c1180a96859e5c54a5359f024a397.svg" alt="">
    </div>
    <script>
        document.querySelector('#phone').addEventListener('focus',function(){
            document.querySelector('.t2').style.display = "block";
        });
        document.querySelector('#phone').addEventListener('blur',function(){
            document.querySelector('.t2').style.display = "none";
        });
        document.querySelector('#pwd').addEventListener('focus',function(){
            document.querySelector('.t1').style.display = "block";
        });
        document.querySelector('#pwd').addEventListener('blur',function(){
            document.querySelector('.t1').style.display = "none";
        });
        document.querySelector('button').addEventListener('click',function(e){
            document.body.style.backgroundColor = "#fff";
            document.querySelector('#app').style.display = "none";
            e.preventDefault();
        });
    </script>
</body>

</html>

css

代码语言:javascript
复制
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #aaabab;
}
#app{
    position: relative;
    height: 290px;
    width: 350px;
    background-color: #fff;
}
#app form{
    position: relative;
    padding: 20px;
}
#app form h2{
    color: #333333;
    font-size: 18px;
    user-select: none;
}
#app form p input{
    width: 100%;
    height: 38px;
    color: #828282;
    border: 1px solid #ddd;
    padding-left: 8px;
    margin-top: 18px;
    border-radius: 2px;
    outline: none;
}
#app form p:nth-of-type(3) input{
    background-color: #007fff;
    color: #edf6ff;
}
#app form a{
    text-decoration: none;
    color: #198fff;
    margin: 10px 0;
    display: inline-block;
    font-size: 15px;
}
#app form p span{
    margin-top: 10px;
    font-size: 14px;
    color: #847f7a;
}
#app form p span small{
    font-size: 14px;
    color: #198fff;
}
button{
    position: absolute;
    top: 20px;
    right: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
}
button::after{
    font-family: "bootstrap-icons";
    content: '\F62A';
    font-size: 24px;
    color: #afafaf;
}
#app img{
    position: absolute;
    width: 100px;
    
    left: 50%;
    transform: translateX(-50%);
    display: none;
}
#app img:nth-of-type(1){
    top: -64px;
}
#app img:nth-of-type(2){
    top: -62px;
}

写在最后

欢迎加入前端实验室读者交流群,群里有不少技术大神,不定时会分享一些技术要点,更有一些资源收藏爱好者会分享一些优质的学习资料。吃瓜、摸鱼、白嫖技术就等你了~

进群方式:在下方公众号后台,回复 111 ,按提示操作即可进群。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-05-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 前端实验室 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 看板娘
  • 猫咪返回顶部
  • 点击爆炸
  • 鼠标点击自定义文字
  • 樱花飘落
  • 掘金登录
  • 写在最后
相关产品与服务
腾讯云 BI
腾讯云 BI(Business Intelligence,BI)提供从数据源接入、数据建模到数据可视化分析全流程的BI能力,帮助经营者快速获取决策数据依据。系统采用敏捷自助式设计,使用者仅需通过简单拖拽即可完成原本复杂的报表开发过程,并支持报表的分享、推送等企业协作场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档