zoukankan      html  css  js  c++  java
  • jQuery 中的简单动画

    制作动画常用方法:

       show("速度")   显示元素
       hide("速度")   隐藏元素
       toggle()       切换效果
    例如下jQuery代码:

    $(function () {
                $("#panel heah").toggle(function ()
                {
                    $(this).next().hide();
                }, function ()
                {
                    $(this).next().show();
                })
            })
       fadeOut() fadeIn() 这两个方法是改变元素的不透明度(实现隐藏和显示的效果)

    例如下jQuery代码:
    $(function () {
                $("#panel heah").toggle(function ()
                {
                    $(this).next().fadeOut();
                }, function ()
                {
                    $(this).next().fadeIn();
                })
            })
       slideUp() slideDown() 这两个方法是改变元素的高度
      例如下jQuery代码:
    $(function () {
                $("#panel heah").toggle(function ()
                {
                    $(this).next().slideUp();
                }, function ()
                {
                    $(this).next().slideDown();
                })
            })
       自定义动画:animate(params,speed,function(){ })

    params:一个包含样式属性及值的映射 

    speed:速度 

    function(){ }:在动画完成之后执行的方法

    例如下jQuery代码:

     $(function ()
            {
                $(document).click(function ()
                {
                    $("#leftbox,#rightbox").animate({ -1 + "px" }, 4000, function ()    //将匹配元素的宽度改为-1px ,4秒完成此操作
                    {
                        $("#coverbox").fadeOut(3000);       //当上一操作完成时,将再次匹配的元素慢慢隐藏 ,3秒完成此操作
                    });
                });
                
            });

  • 相关阅读:
    木马控制技术(二) -- 端口复用
    OSQL.EXE 命令行下脱裤mssql
    移动App中常见的Web漏洞
    phpcms前台任意代码执行漏洞(php<5.3)
    LeetCode OJ--Copy List with Random Pointer **
    LeetCode OJ-- Container With Most Water
    LeetCode OJ--Combinations *
    LeetCode OJ-- Combination Sum II **
    LeetCode OJ--Combination Sum **
    LeetCode OJ-- Candy **
  • 原文地址:https://www.cnblogs.com/scc-/p/9512541.html
Copyright © 2011-2022 走看看