1. <small id='SlhaM'></small><noframes id='SlhaM'>

        <i id='SlhaM'><tr id='SlhaM'><dt id='SlhaM'><q id='SlhaM'><span id='SlhaM'><b id='SlhaM'><form id='SlhaM'><ins id='SlhaM'></ins><ul id='SlhaM'></ul><sub id='SlhaM'></sub></form><legend id='SlhaM'></legend><bdo id='SlhaM'><pre id='SlhaM'><center id='SlhaM'></center></pre></bdo></b><th id='SlhaM'></th></span></q></dt></tr></i><div id='SlhaM'><tfoot id='SlhaM'></tfoot><dl id='SlhaM'><fieldset id='SlhaM'></fieldset></dl></div>

        • <bdo id='SlhaM'></bdo><ul id='SlhaM'></ul>
      1. <tfoot id='SlhaM'></tfoot>
        <legend id='SlhaM'><style id='SlhaM'><dir id='SlhaM'><q id='SlhaM'></q></dir></style></legend>

        结合悬停和单击功能(jQuery)?

        Combine hover and click functions (jQuery)?(结合悬停和单击功能(jQuery)?)

        <small id='FmQ2u'></small><noframes id='FmQ2u'>

        • <bdo id='FmQ2u'></bdo><ul id='FmQ2u'></ul>

              <tbody id='FmQ2u'></tbody>
          1. <i id='FmQ2u'><tr id='FmQ2u'><dt id='FmQ2u'><q id='FmQ2u'><span id='FmQ2u'><b id='FmQ2u'><form id='FmQ2u'><ins id='FmQ2u'></ins><ul id='FmQ2u'></ul><sub id='FmQ2u'></sub></form><legend id='FmQ2u'></legend><bdo id='FmQ2u'><pre id='FmQ2u'><center id='FmQ2u'></center></pre></bdo></b><th id='FmQ2u'></th></span></q></dt></tr></i><div id='FmQ2u'><tfoot id='FmQ2u'></tfoot><dl id='FmQ2u'><fieldset id='FmQ2u'></fieldset></dl></div>
              <legend id='FmQ2u'><style id='FmQ2u'><dir id='FmQ2u'><q id='FmQ2u'></q></dir></style></legend>

                  <tfoot id='FmQ2u'></tfoot>
                  本文介绍了结合悬停和单击功能(jQuery)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可以将悬停和点击功能合二为一,例如:

                  Can hover and click functions be combined into one, so for example:

                  点击:

                  $('#target').click(function() {
                    // common operation
                  });
                  

                  悬停:

                  $('#target').hover(function () {
                      // common operation
                  });
                  

                  它们可以组合成一个功能吗?

                  can they be combined into one function?

                  谢谢!

                  推荐答案

                  使用基本的编程组合:创建一个方法并将相同的函数传递给 clickhover 作为回调.

                  Use basic programming composition: create a method and pass the same function to click and hover as a callback.

                  var hoverOrClick = function () {
                      // do something common
                  }
                  $('#target').click(hoverOrClick).hover(hoverOrClick);
                  

                  <小时>

                  第二种方式:使用bindon:

                  $('#target').on('click mouseover', function () {
                      // Do something for both
                  });
                  

                  <小时>

                  jQuery('#target').bind('click mouseover', function () {
                      // Do something for both
                  });
                  

                  这篇关于结合悬停和单击功能(jQuery)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  业务场景:使用update语句去更新数据库字段。 原因:update接收值不正确。原来代码: $query = "UPDATE student SET date = now() WHERE id = $id";$result = $mysqli-query($query2) or die($mysqli-error); // 问题出现了在这句 $data = $result-fetch_ass
                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)

                    <tbody id='eSw8M'></tbody>
                    • <i id='eSw8M'><tr id='eSw8M'><dt id='eSw8M'><q id='eSw8M'><span id='eSw8M'><b id='eSw8M'><form id='eSw8M'><ins id='eSw8M'></ins><ul id='eSw8M'></ul><sub id='eSw8M'></sub></form><legend id='eSw8M'></legend><bdo id='eSw8M'><pre id='eSw8M'><center id='eSw8M'></center></pre></bdo></b><th id='eSw8M'></th></span></q></dt></tr></i><div id='eSw8M'><tfoot id='eSw8M'></tfoot><dl id='eSw8M'><fieldset id='eSw8M'></fieldset></dl></div>

                      <small id='eSw8M'></small><noframes id='eSw8M'>

                    • <tfoot id='eSw8M'></tfoot>
                          <bdo id='eSw8M'></bdo><ul id='eSw8M'></ul>
                          <legend id='eSw8M'><style id='eSw8M'><dir id='eSw8M'><q id='eSw8M'></q></dir></style></legend>