zoukankan      html  css  js  c++  java
  • jQuery链式编程时修复断开的链

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <script src="scripts/jquery-1.8.2.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    $('#uone li').mouseover(function () {

    //鼠标悬浮事件
    $(this).css('backgroundColor', 'red').siblings('li').css('backgroundColor', '');


    }).click(function () {
    //单击事件
    //有些方法是会破坏链式编程中返回的对象的,比如:next(),nextAll(),prev(),prevAll(),siblings(),无参数的:text()、val()、html()
    //当链式编程的链被破坏以后可以通过end()方法修复。
    $(this).prevAll().css('background-color', 'yellow').end().nextAll().css('backgroundColor', 'blue');
    });
    });
    </script>
    </head>
    <body>
    <ul id="uone">
    <li>公牛</li>
    <li>小牛</li>
    <li>森林狼</li>
    <li>开拓者</li>
    </ul>
    </body>
    </html>

  • 相关阅读:
    全局数据库名称/数据库实例/SID 的区别
    【转载】ORACLE 10G DBCA创建脚本实现手动创建数据库
    apue 20130328
    apue 20130323
    visual c++6.0
    C语言
    apue 20130322
    apue 20130324
    apue 20130325
    C语言里的字符串解析
  • 原文地址:https://www.cnblogs.com/jiangyunfeng/p/11808800.html
Copyright © 2011-2022 走看看