博客
关于我
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/

    你可能感兴趣的文章
    Node读取并输出txt文件内容
    查看>>
    node防xss攻击插件
    查看>>
    noi 7827 质数的和与积
    查看>>
    NOIp2005 过河
    查看>>
    NOIp模拟赛二十九
    查看>>
    NOPI读取Excel
    查看>>
    NoSQL&MongoDB
    查看>>
    NoSQL介绍
    查看>>
    NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
    查看>>
    Now trying to drop the old temporary tablespace, the session hangs.
    查看>>
    np.arange()和np.linspace()绘制logistic回归图像时得到不同的结果?
    查看>>
    npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装
    查看>>
    npm install digital envelope routines::unsupported解决方法
    查看>>
    npm install 卡着不动的解决方法
    查看>>
    npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
    查看>>
    npm install 报错 no such file or directory 的解决方法
    查看>>
    npm install报错,证书验证失败unable to get local issuer certificate
    查看>>
    npm install无法生成node_modules的解决方法
    查看>>
    npm node pm2相关问题
    查看>>
    npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
    查看>>