zoukankan      html  css  js  c++  java
  • Jquery效果animate,toggle

    animate() 方法执行 CSS 属性集的自定义动画。

    语法:$("divImg").animate(styles,speed,easing,callback)

    参数:styles 必填,规定产生动画效果的 CSS 样式和值

            speed 可选,规定动画产生速度,默认normal,还有fast ,slow,毫秒值

          easing 可选,不同的动画点种设置速度(很少使用)

         callback可选,animate函数之后执行的函数

    toggle() 方法切换元素的可见状态。

    语法:$(selector).toggle(speed,callback,switch)

    参数:三个参数都是可选的,

    switch:布尔值。规定 toggle 是否隐藏或显示所有被选元素。true、false,如果设置此参数,则无法使用 speed和 callback 参数。

    实例:

    View Code
     1 <script type="text/javascript">
    2 // 收缩展开效果
    3 $(document).ready(function () {
    4 $(".information_title").toggle(function () {
    5 $(this).next(".information_contant").animate({ height: 'toggle', opacity: 'toggle' }, "slow");
    6 }, function () {
    7 $(this).next(".information_contant").animate({ height: 'toggle', opacity: 'toggle' }, "slow");
    8 });
    9 });
    10 </script>
    11
    12 <div class="information_title">
    13
    14
    15 </div>
    16
    17 <div class="information_contant">
    18
    19 </div>



  • 相关阅读:
    ARC 080
    CodeForces
    [Lydsy1806月赛] 路径统计
    AGC 022 C
    AGC 022 B
    AGC 020 B
    UVA
    AGC 018 A
    python
    python
  • 原文地址:https://www.cnblogs.com/lei2007/p/2203393.html
Copyright © 2011-2022 走看看