博客
关于我
jQuery中事件及常用事件总结、jQuery中常见效果、饮食迭代、链式编程、样式操作、动画队列
阅读量:342 次
发布时间:2019-03-04

本文共 2904 字,大约阅读时间需要 9 分钟。

jQuery?????????

jQuery???????JavaScript?????????????????????????jQuery????????????????????????jQuery??????

??jQuery????

jQuery?????JavaScript???????????????????????????????jQuery?????????????????????????????????

$('input').click(function() {    alert('hello word');});

????????????input??????????alert('hello word')?????"hello word"????

????jQuery??

jQuery???????????????????

  • click??
  • click()?????????????????????

    $('div').click(function() {    alert('??????');});
    1. mouseover/mouseout??
    2. ??????????????????mouseover()??????????????mouseout()?????????????????

      $('div').mouseover(function() {    console.log('????div??');}).mouseout(function() {    console.log('????div??');});
      1. hover??
      2. hover()???jQuery????????????????????????????????????????????????????

        $('div').hover(function() {    $(this).css('background-color', 'red');}, function() {    $(this).css('background-color', '#fff');});

        ????jQuery??

        jQuery?????????????????????????????????????????????

      3. hide()/show()/toggle()
      4. ?????????????????hide()?????show()?????toggle()?????????????

        $('div').toggle();// ??????div??????$(div).toggle();// ??????div??????
        1. slideDown()/slideUp()/slideToggle()
        2. ??????????????????slideDown()??????????????slideUp()?????????????slideToggle()???????????????

          $('div').slideUp(1000); // ????$(div).slideDown(1000); // ????$(div).slideToggle(); // ??????
          1. animate()
          2. animate()????????????????????????????????????????????????????????????

            $(div).animate({    height: '300px',    width: '300px'}, function() {    $(div).css('background-color', 'green');});
            1. fadeOut()/fadeTo()
            2. ???????????????fadeOut()????????????fadeTo()???????????????

              $(div).fadeOut();$(div).fadeTo(null, 0.1); // ?50%???????
              1. stop()
              2. stop()???????????????????????????????????????????

                $(div).animate({width: '500px'}, 2000);$(div).animate({height: '500px'}, 2000);$(button).click(function() {    $(div).stop(); // ??????});

                ??????

                jQuery?????????????????????????????????????????

                $('div').hide(); // ??????????div????

                ???????????????????????

                ??????

                jQuery????????????????????????????????

                $(this).css('color', 'red').siblings().css('color', 'white');

                ???????????????????

                ??jQuery????

                jQuery???????????????css()???????

              3. ??css()??
              4. css()???????????????????????????

                • ????????????
                  var fontSize = $('p').css('fontSize');
                • ???????????????????
                  $('div').css('color', 'red');
                • ???????????????
                  $('p').css({    'color': 'white',    'fontSize': '20px'});
                1. ???????
                2. jQuery??????????????????????

                  • ????
                    $('div').addClass('hide');
                  • ????
                    $('div').removeClass('show');
                  • ????
                    $('div').toggleClass('showHide');

                  ???????????

                  ?????????????????????????????????????????????????????????????stop()??????????????

                  $(button).click(function() {    $('div').stop().slideToggle(2000);});

                  ??hover????

                  jQuery???hover()??????CSS?:hover????????????????????????????????

                  $('div').hover(function() {    $('li').hide();}, function() {    $('li').show();});

                  ????????????????jQuery?????????????????????????????????????????????

    转载地址:http://pone.baihongyu.com/

    你可能感兴趣的文章
    NFS网络文件系统
    查看>>
    nft文件传输_利用remoting实现文件传输-.NET教程,远程及网络应用
    查看>>
    ng 指令的自定义、使用
    查看>>
    nginx + etcd 动态负载均衡实践(二)—— 组件安装
    查看>>
    nginx + etcd 动态负载均衡实践(四)—— 基于confd实现
    查看>>
    Nginx + Spring Boot 实现负载均衡
    查看>>
    Nginx + uWSGI + Flask + Vhost
    查看>>
    Nginx - Header详解
    查看>>
    Nginx Location配置总结
    查看>>
    Nginx upstream性能优化
    查看>>
    Nginx 中解决跨域问题
    查看>>
    Nginx 动静分离与负载均衡的实现
    查看>>
    Nginx 反向代理 MinIO 及 ruoyi-vue-pro 配置 MinIO 详解
    查看>>
    Nginx 反向代理解决跨域问题
    查看>>
    Nginx 反向代理配置去除前缀
    查看>>
    nginx 后端获取真实ip
    查看>>
    Nginx 学习总结(17)—— 8 个免费开源 Nginx 管理系统,轻松管理 Nginx 站点配置
    查看>>
    nginx 常用配置记录
    查看>>
    Nginx 我们必须知道的那些事
    查看>>
    Nginx 的 proxy_pass 使用简介
    查看>>