zoukankan      html  css  js  c++  java
  • jquery简单动画

    自定义滑入滑出动画

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
        <script src="js/jquery-1.7.1.min.js"></script>
        <style>
    
            .a {
            float:left;
            100px;
            height:40px;
            background-color:darkblue;
            overflow:hidden;
            margin-left:20px;
            }
            .b {
            100px;
    
            top:40px;
            position:relative;
            background-color:yellow;
            }
        </style>
    
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div class="a">
            <div class="b" style="height:50px;"></div></div>
            <div class="a">
            <div class="b" style="height:100px;"></div></div>
            <div class="a">
            <div class="b" style="height:200px;"></div></div>
            <div class="a">
            <div class="b" style="height:300px;"></div></div>
            <div class="a">
            <div class="b" style="height:400px;"></div></div>
            <div class="a">
            <div class="b" style="height:500px;"></div></div>
    
        </form>
    </body>
    </html>
    <script>
        $(".a").hover(function () {
            var s = $(this).children($(".b:first")).height();//animate:自定义动画
            $(this).stop().animate({"height":(s+40)},500);//stop():停止动画,防止动画积累
    
        }, function () {
            $(this).stop().animate({ "height": "40px" }, 500);
        });
    
    
    
    </script>
    View Code
  • 相关阅读:
    我所知道的数据库8-DML语言
    我所知道的数据库7-DDL语言(续2)
    CSS3 3D transform变换
    深入理解Node.js的异步编程风格(转载)
    ECMAscript
    JavaScript高级部分概念用法
    前端工程师面试题汇总
    10个最常见的HTML5中的面试题及答案
    js事件流
    本地储存
  • 原文地址:https://www.cnblogs.com/wwz-wwz/p/6050001.html
Copyright © 2011-2022 走看看