|
发表于 2019-11-5 21:43:48
|
显示全部楼层
comming~ 
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>页面切换</title>
- <style type="text/css">
- /* 样式清除表 */
- html,body,h1,p {
- margin: 0;
- padding: 0;
- }
- html,body {
- height: 100%;
- }
- body {
- font-family: 'STXingkai';
- position: relative;
- overflow: hidden;
- text-align: center;
- }
- article {
- height: 100%;
- width: 100%;
- box-sizing: border-box;
- padding:100px;
- transition:all .9s linear;
- position: absolute;
- top:0;
- }
- h1 {
- font-size: 33px;
- border-bottom: 1px solid rgba(52, 73, 94,.5);
- margin-bottom: 10px;
- }
- p {
- font-size: 22px;
- margin-bottom: 10px;
- }
- a {
- font-size:44px;
- text-decoration:none;
- border:1px solid rgba(26, 188, 156,.5);
- padding: 5px 20px;
- border-radius:10px;
- }
- #poor > img {
- height: 488px;
- }
- #rich > img {
- height: 488px;
- }
- /* 固定初始位置 */
- #poor {
- left:0;
- }
- #rich {
- left:100%;
- }
- /* 动画呈现位置 */
- #poor.move {
- left:100%;
- }
- #rich.move {
- left:0;
- }
- </style>
- </head>
- <body>
- <article id="poor">
- <img src="poor.png" alt="poor">
- <h1>驱动学习的力量是恐惧。</h1>
- <p>穷爸爸:"你要好好学习,以后就能找一份好工作养活自己。"</p>
- <a href="#rich">Rich</a>
- </article>
- <article id="rich">
- <img src="rich.png" alt="rich">
- <h1>驱动力量是爱,好好学习就会帮到更多的人。</h1>
- <p>富爸爸:"你要好好学习,以后开自己的公司,创造就业机会给别人。"</p>
- <a href="#poor">Poor</a>
- </article>
- </body>
- <script type="text/javascript" src="jquery-2.1.4.min/jquery-2.1.4.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- $('a').click(function (e) {
- e.preventDefault();
- $('#rich').toggleClass('move');
- $('#poor').toggleClass('move');
- });
- });
- </script>
- </html>
复制代码 |
|