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
  • 相关阅读:
    jQuery学习笔记(一):入门
    jQuery学习笔记(二):this相关问题及选择器
    数据库基础
    有关程序员转行的想法
    在团队中如何带领新手——阅读有感
    C#中的集合类——ArrayList
    .NET基础——ASSCII码表
    C#中的文件操作2
    C#中的文件操作1
    C#中的StringBuilder
  • 原文地址:https://www.cnblogs.com/wwz-wwz/p/6050001.html
Copyright © 2011-2022 走看看