前端让网站首页加载动画在显示内容

news/2024/5/20 20:39:32/文章来源:https://blog.csdn.net/weixin_42337801/article/details/108755243

最近遇到了一个需求就是网站在加载时先加载一个动画,点击动画的任意位置在出现首页内容
试了很多种方法,自己想了一种思路
1,首先把首页内容和动画内容分开,body先设置display:none,隐藏
在这里插入图片描述

2,写js这里的意思是页面,设置两个定时器,在点击时关闭定时器,现实首页内容
在这里插入图片描述
3,
参考动画

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>百叶窗</title><link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script><script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script><style>* {padding: 0px;margin: 0px;}body {font-family: "微软雅黑";font-size: 14px;color: #212121;position: relative;min-width: 1280px;}li {list-style: none;}ul {padding: 0;margin: 0;}a {color: #444;text-decoration: none}a:hover {text-decoration: none !important;color: #272d5a;}a:focus {text-decoration: none !important;outline: none !important;}button:focus,button:hover {outline: none !important;}ul,ol {margin: 0;padding: 0;}img {max-width: 100%;}input,button {outline: none;}#btn {position: fixed;left: 0;top: 0;right: 0;bottom: 0;}.animates {overflow: hidden;position: relative;display: none;background-color: black;}.animates.bbb {display: block;}.animates::before {display: block;content: "";position: absolute;z-index: -1111;right: 50%;left: 0;top: 0;bottom: 0;background: #000;animation: eee 1s;-moz-animation: eee 1s;-webkit-animation: eee 1s;-o-animation: eee 1s;animation-delay: 1s;-webkit-animation-delay: 1s;}@keyframes eee {0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}@-moz-keyframes eee/* Firefox */{0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}@-webkit-keyframes eee/* Safari and Chrome */{0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}@-o-keyframes eee/* Opera */{0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}.animates::after {display: block;content: "";position: absolute;z-index: -1111;left: 50%;right: 0;top: 0;bottom: 0;background: #000;animation: fff 1s;-moz-animation: fff 1s;-webkit-animation: fff 1s;-o-animation: fff 1s;animation-delay: 1s;-webkit-animation-delay: 1s;}@keyframes fff {0% {left: 50%;z-index: 1000;}99% {left: 100%;z-index: 1000;}100% {z-index: -111;}}@-moz-keyframes fff/* Firefox */{0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}@-webkit-keyframes fff/* Safari and Chrome */{0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}@-o-keyframes fff/* Opera */{0% {right: 50%;z-index: 1000;}99% {right: 100%;z-index: 1000;}100% {z-index: -111;}}.animates .animate1::after {clear: both;display: block;content: '';}.animates .animate1 {max-width: 1770px;margin: 0 auto;position: relative;zoom: 1;}.animates img {width: 100%;height: 1000px;}.animates .animate1 .an-left {width: 50%;float: left;height: 1000px;overflow: hidden;background-color: cornflowerblue;animation: an-left 1s;-moz-animation: an-left 1s;/* Firefox */-webkit-animation: an-left 0s;/* Safari and Chrome */-o-animation: an-left 0s;/* Opera */animation-delay: 1s;-webkit-animation-delay: 1s;/* Safari 和 Chrome */transform: translate(0, 0);}@keyframes an-left {from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}@-moz-keyframes an-left/* Firefox */{from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}@-webkit-keyframes an-left/* Safari and Chrome */{from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}@-o-keyframes an-left/* Opera */{from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}.animates .animate1 .an-right {width: 50%;float: left;height: 1000px;overflow: hidden;background-color: darksalmon;animation: an-right 1s;-moz-animation: an-right 1s;/* Firefox */-webkit-animation: an-right 1.5s;/* Safari and Chrome */-o-animation: an-right 1s;/* Opera */animation-delay: 1s;-webkit-animation-delay: 1s;/* Safari 和 Chrome */transform: translate(0, 0);}@keyframes an-right {from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}@-moz-keyframes an-right/* Firefox */{from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}@-webkit-keyframes an-right/* Safari and Chrome */{from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}@-o-keyframes an-right/* Opera */{from {transform: translate(100%, 0);}to {transform: translate(0, 0);}}.animate2 {position: relative;display: none;}.animate2.aaa {display: block;}.animate2::after {display: block;content: "";position: absolute;left: 0;right: 0;bottom: 0;background: #000;animation: aaa 1s;-moz-animation: aaa 1s;/* Firefox */-webkit-animation: aaa 1s;/* Safari and Chrome */-o-animation: aaa 1s;/* Opera */animation-delay: 3s;-webkit-animation-delay: 3s;/* Safari 和 Chrome */}@keyframes aaa {from {top: 100%;}to {top: 50%;}}@-moz-keyframes aaa/* Firefox */{from {top: 100%;}to {top: 50%;}}@-webkit-keyframes aaa/* Safari and Chrome */{from {top: 100%;}to {top: 50%;}}@-o-keyframes aaa/* Opera */{from {top: 100%;}to {top: 50%;}}.animate2::before {display: block;content: "";position: absolute;left: 0;right: 0;top: 0;background: #000;animation: myfirst 1s;-moz-animation: myfirst 1s;/* Firefox */-webkit-animation: myfirst 1s;/* Safari and Chrome */-o-animation: myfirst 1s;/* Opera */animation-delay: 3s;-webkit-animation-delay: 3s;/* Safari 和 Chrome */}@keyframes myfirst {from {bottom: 100%;}to {bottom: 50%;}}@-moz-keyframes myfirst/* Firefox */{from {bottom: 100%;}to {bottom: 50%;}}@-webkit-keyframes myfirst/* Safari and Chrome */{from {bottom: 100%;}to {bottom: 50%;}}@-o-keyframes myfirst/* Opera */{from {bottom: 100%;}to {bottom: 50%;}}.animate2 .an-top {width: 100%;height: 500px;background-color: green;animation: an-top 1s;-moz-animation: an-top 1s;/* Firefox */-webkit-animation: an-top 1s;/* Safari and Chrome */-o-animation: an-top 1s;/* Opera */animation-delay: 3s;-webkit-animation-delay: 3s;/* Safari 和 Chrome */}@keyframes an-top {from {transform: translate(0, 0);}to {transform: translate(0, 100%);}}@-moz-keyframes an-top/* Firefox */{from {transform: translate(0, 0);}to {transform: translate(0, 100%);}}@-webkit-keyframes an-top/* Safari and Chrome */{from {transform: translate(0, 0);}to {transform: translate(0, 100%);}}@-o-keyframes an-top/* Opera */{from {transform: translate(0, 0);}to {transform: translate(0, 100%);}}.animate2 .an-bottom {width: 100%;height: 500px;background-color: brown;animation: an-bottom 1s;-moz-animation: an-bottom1s;/* Firefox */-webkit-animation: an-bottom 0s;/* Safari and Chrome */-o-animation: an-bottom 0s;/* Opera */animation-delay: 3s;-webkit-animation-delay: 3s;/* Safari 和 Chrome */}.animate2 img {width: 100%;height: 500px;display: block;}@keyframes an-bottom {from {transform: translate(0, 0);}to {transform: translate(0, 100%);}}@-moz-keyframes an-bottom/* Firefox */{from {transform: translate(0, 0);}to {transform: translate(100%, 0);}}@-webkit-keyframes an-bottom/* Safari and Chrome */{from {transform: translate(0, 0);}to {transform: translate(100%, 0);}}@-o-keyframes an-bottom/* Opera */{from {transform: translate(0, 0);}to {transform: translate(100%, 0);}}</style>
</head><body><div class="animates bbb"><div class="animate1"><div class="an-left"><!-- <img src="img/left.png"> --></div><div class="an-right"><!-- <img src="img/right.png"> --></div></div></div><div class="animate2"><div class="an-top"><!-- <img src="img/top.png"> --></div><div class="an-bottom"><!-- <img src="img/bottom.png"> --></div></div><a href="www.baidu.com" id="btn"></a>
</body><script>window.onload = function() {setInterval("$('.animate2').toggleClass('aaa')", 4000);setInterval("$('.animates').toggleClass('bbb')", 4000);}
</script></html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_744075.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

IIS网站部署报错解决办法

出现该种错误解决办法&#xff1a; 1. 管用员权限进入cmd命令提示符界面&#xff0c;执行命令"cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319"&#xff0c; 运行&#xff1a; aspnet_regiis.exe -i 注意&#xff1a;32位操作系统路径是C:\Windows\Microsoft.N…

简单代码实现 网站灰色蒙版

给网站加灰色蒙版 就是下面的一点点代码 -webkit-filter: grayscale(1);filter: grayscale(1);也可以这样 -webkit-filter: grayscale(100%);-moz-filter: grayscale(100%);-ms-filter: grayscale(100%);-o-filter: grayscale(100%);filter: grayscale(100%);filter: progid:…

iis6.0服务器同时设置多个网站,iis6.0同时运行.net2.0和net4.0的配置方法

前几天在一个IIS6.0上配置两个网站&#xff0c;本以为很简单&#xff0c;因为配置了10多年&#xff0c;非常熟悉了&#xff0c;但是当配置完毕运行后&#xff0c;却出现了从没遇到过的问题&#xff1a;两个网站不能同时运行&#xff0c;当先访问A站&#xff0c;再访问B站时就报…

解决火车头7.6版本对一些https网站的采集报错问题

针对火车头7.6爬取https网站报错System.Net.HttpWebRequest问题的处理方案 1.先看看火车头7.6爬取https网站时出现的报错情况 System.Net.HttpWebRequest 2.废话不多说&#xff0c;先看看解决方案的vb.net教程效果&#xff0c;可以看到已经没有报错了&#xff0c;而且标题也采…

vue3项目网站自适应大屏幕宽度(width>1920)

vue3项目自适应屏幕宽度 安装插件&#xff1a;lib-flexible、postcss-px2rem、px2rem-loader cnpm install lib-flexible --save cnpm install postcss-px2rem --save lib-flexible是来作为移动端适配的解决方案的&#xff0c;postcss-px2rem将代码中px自动转化成对应的rem的…

用php写的亲亲鲜花网站_用Flask写一个极简版课堂测验网站(2)

今日实现&#xff1a;学生名单导入和登录判定名单导入功能的基本实现&#xff1a;upload.html<html lang"en"><head> <meta charset"UTF-8"> <title>文件上传title>head><body><h1>导入EXCEL文件h1>&l…

网站更换国外服务器,备案被注销替换外国服务器?这样合理吗?

备案被注销替换外国服务器&#xff1f;这样合理吗&#xff1f;关于域名备案的话题最近很多网友在询问&#xff0c;针对这个话题&#xff0c;相信很多人都有自己的见解&#xff0c;今天查ICP网的编辑就针对以上问题来给大家做一个解答&#xff0c;也希望这个解答可以让很多对于域…

scrapy爬虫框架你还不会吗?简单使用爬虫框架采集网站数据

前言 本文的文字及图片过滤网络&#xff0c;可以学习&#xff0c;交流使用&#xff0c;不具有任何商业用途&#xff0c;如有问题请及时联系我们以作处理。 本篇文章就使用python爬虫框架scrapy采集网站的一些数据。 Python爬虫、数据分析、网站开发等案例教程视频免费在线观看…

Python爬取视频网站弹幕,并做成词云图

本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理。 作者&#xff1a;张同学 来源&#xff1a;凹凸数据 Python爬虫、数据分析、网站开发等案例教程vb.net教程视频免费在线观看 https://www.xin3721.com/eschool/pythonxi…

Python爬虫入门教程15:音乐网站数据的爬取

基本开发环境&#x1f4a8; Python 3.6 Pycharm 相关模块的使用&#x1f4a8; import requests import os 安装Python并添加到环境变量&#xff0c;pip安装需要的相关模块即可。 一、&#x1f4a5;明确需求 爬取某音乐网站的排行榜歌曲。 二、&#x1f4a5;网页数据分析 1、…

建站记录2-CSS文件未加载-已解决-Resource interpreted as Stylesheet but transferred with MIME type text/plain

在本地加载正常&#xff0c;上传到服务器之后&#xff0c;网页没有样式。 解决问题的过程&#xff1a; 是否路径问题&#xff1f; —>分析&#xff1a;应该不是路径问题。页面中引用了图片&#xff0c;路径格式与CSS文件相同&#xff0c;图片可以正确加载。 —>操作–需…

快速把网站变成纯灰度显示,filter的使用

在html标签加上 <style>html {filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale1);-webkit-filter: grayscale(100%);} </style>filter https://developer.mozilla.org/zh-CN/docs/Web/CSS/filter filter CSS属性将模糊或颜色偏移等图形效果应用…

C# 关于爬取网站数据遇到csrf-token的分析与解决

需求 某航空公司物流单信息查询&#xff0c;是一个post请求。通过后台模拟POST HTTP请求发现无法获取页面数据&#xff0c;通过查看航空公司网站后&#xff0c;发现网站使用避免CSRF攻击机制&#xff0c;直接发挥40X错误。 关于CSRF 读者自行百度 网站HTTP请求分析 Headers …

随机切换必应美图html代码,随机显示必应每日一张图片为背景网站技巧教程

摘要&#xff1a; 主题有好多模板设置了分类的背景图&#xff0c;调用了第三方api但是最近第三方挂了&#xff0c;嗯嗯&#xff0c;这就是图省事不写代码的后果&#xff0c;一旦图片都失效&#xff0c;网站打开速度慢不说&#xff0c;图片的背景图还是灰蒙蒙一片&#xff0c;非…

C# 关于爬取网站数据遇到csrf-token的分析与解决

需求 某航空公司物流单信息查询&#xff0c;是一个post请求。通过后台模拟POST HTTP请求发现无法获取页面数据&#xff0c;通过查看航空公司网站后&#xff0c;发现网站使用避免CSRF攻击机制&#xff0c;直接发挥40X错误。 关于CSRF 读者自行百度 网站HTTP请求分析 Headers F…

java爬虫项目_「java爬虫」Java爬虫项目环境搭建 - seo实验室

java爬虫Github clone项目、创建分支下载Github for windows桌面客户端把master主分支clone到本地先把master主分支clone到本地 客户端界面操作&#xff1a; File-Clone repository 选中要clone的项目创建自己的分支 客户端界面操作&#xff1a;Branch-New branch 基于master创…

解决ASP网站HTTP 错误 500.19:httpErrors 节中不允许绝对物理路径

工作需要&#xff0c;需要vb.net教程维护一个asp的网站&#xff0c;网站十多年了&#xff0c;代码已经很难理清。Asp技术就不用多说了&#xff0c;二十多年前的技术&#xff0c;现在vs都已经不支持c#教程此种类型的项目。维护起来十分头疼&#xff0c;将来要写个东西替代它&…

.php容易收录吗,Wordpress容易被收录吗(Wordpress网站快速收录解决方法)

WordPress是使用PHP语言开发的博客CMS系统&#xff0c;有人问用WordPress做网站容易被收录吗?文章收录慢、不收录问题&#xff0c;小编整理了解决方法&#xff0c;让你的Wordpress网站快速被百度收录。百度作为最大的中文搜索引擎&#xff0c;现在推出了“快速收录”&#xff…

采购网站服务器的请示,关于采购云服务器的请示

关于采购云服务器的请示 内容精选换一换本文档主要介绍两种扩容场景&#xff0c;分别为扩容云服务器和扩容云硬盘。在“确认配置”页面&#xff0c;查看云服务器配置详情。如果您对价格有疑问&#xff0c;可以单击“了解计费详情”来了解产品价格。如果您对价格有疑问&#xff…

社交网站后端项目开发日记(二)

本项目vb.net教程目标是开发一个社区网c#教程站&#xff0c;拥python基础教程有发帖、讨论、搜索、登录等一个java基础教程正常社区拥有sql教程的功能。涉及到的版本参数为&#xff1a; JDK1.8Maven3.8.1&#xff08;直接集成到IDEA&#xff09;Springboot 2.5.1tomcat 9.0.45M…