<tfoot id='p8VWz'></tfoot>
    <bdo id='p8VWz'></bdo><ul id='p8VWz'></ul>
  • <small id='p8VWz'></small><noframes id='p8VWz'>

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

        由于 z-index 导致的 jQuery 悬停问题

        时间:2023-11-01

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

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

                  本文介绍了由于 z-index 导致的 jQuery 悬停问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想使用 jQuery 为元素触发悬停事件,但我使用 z-index 在元素上方放置了一个半透明的 png.有没有办法告诉jQuery忽略png并触发它下面元素的悬停事件?

                  I want to trigger a hover event for an element using jQuery, but I have an semi-transparent png positioned over the element using z-index. Is there any way to tell jQuery to ignore the png and trigger the hover event for the element underneath it?

                  推荐答案

                  如果您使用的是支持 css3 的现代浏览器,请尝试将此行添加到透明 png 的 css 规则中:pointer-events: none;
                  它基本上告诉浏览器忽略此元素上的所有鼠标事件.

                  If you are using a modern browser that supports css3, try adding this line to the css rule for the transparent png: pointer-events: none;
                  It basically tells the browser to ignore all mouse events on this element.

                  例如:

                  img
                  {
                      pointer-events: none;
                  }
                  

                  https://developer.mozilla.org/en/css/pointer-events

                  或者,如果您的目标浏览器不支持 css3,您可以捕获鼠标事件,然后在底层元素上触发一个新事件.

                  Alternatively if your targeted browser does not support css3, you can capture the mouse event and then fire a new one on the underlying element.

                  例如,如果您的图像 id 是 #img 并且您的底层元素 id 是 #elem 您可以这样做:

                  for example if your image id is #img and your underlying element id is #elem you may do this:

                  $("#elem").hover(function(e){
                       $("#img").mouseenter(e);
                  });
                  

                  根据 DOM 的设置方式,您可能需要稍微处理一下,这里是文档 http://api.jquery.com/mouseenter/

                  You might have to mess with this a little depending on how your DOMs are set up, here's the documentation http://api.jquery.com/mouseenter/

                  这篇关于由于 z-index 导致的 jQuery 悬停问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:CSS:悬停在其他元素上? 下一篇:jQuery图像悬停颜色叠加

                  相关文章

                      <tfoot id='52xMS'></tfoot>
                    1. <legend id='52xMS'><style id='52xMS'><dir id='52xMS'><q id='52xMS'></q></dir></style></legend>

                      <small id='52xMS'></small><noframes id='52xMS'>

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

                      • <bdo id='52xMS'></bdo><ul id='52xMS'></ul>