1. <small id='92ZZD'></small><noframes id='92ZZD'>

    2. <tfoot id='92ZZD'></tfoot>

      • <bdo id='92ZZD'></bdo><ul id='92ZZD'></ul>
      <legend id='92ZZD'><style id='92ZZD'><dir id='92ZZD'><q id='92ZZD'></q></dir></style></legend>

      <i id='92ZZD'><tr id='92ZZD'><dt id='92ZZD'><q id='92ZZD'><span id='92ZZD'><b id='92ZZD'><form id='92ZZD'><ins id='92ZZD'></ins><ul id='92ZZD'></ul><sub id='92ZZD'></sub></form><legend id='92ZZD'></legend><bdo id='92ZZD'><pre id='92ZZD'><center id='92ZZD'></center></pre></bdo></b><th id='92ZZD'></th></span></q></dt></tr></i><div id='92ZZD'><tfoot id='92ZZD'></tfoot><dl id='92ZZD'><fieldset id='92ZZD'></fieldset></dl></div>
    3. 元素从鼠标下方移出后,悬停状态为粘性(在所有浏览器中)

      时间:2023-11-29

        <tbody id='o6H5O'></tbody>
    4. <legend id='o6H5O'><style id='o6H5O'><dir id='o6H5O'><q id='o6H5O'></q></dir></style></legend>

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

              <bdo id='o6H5O'></bdo><ul id='o6H5O'></ul>
            • <i id='o6H5O'><tr id='o6H5O'><dt id='o6H5O'><q id='o6H5O'><span id='o6H5O'><b id='o6H5O'><form id='o6H5O'><ins id='o6H5O'></ins><ul id='o6H5O'></ul><sub id='o6H5O'></sub></form><legend id='o6H5O'></legend><bdo id='o6H5O'><pre id='o6H5O'><center id='o6H5O'></center></pre></bdo></b><th id='o6H5O'></th></span></q></dt></tr></i><div id='o6H5O'><tfoot id='o6H5O'></tfoot><dl id='o6H5O'><fieldset id='o6H5O'></fieldset></dl></div>
            • <tfoot id='o6H5O'></tfoot>
              • 本文介绍了元素从鼠标下方移出后,悬停状态为粘性(在所有浏览器中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个显示一系列幻灯片的 div,一次一张.它在框的底部包含一个链接,可触发切换到下一张幻灯片.单击链接时,框会显示下一张幻灯片,并且框的高度大部分时间都会发生变化.

                I have a div that shows a series of slides, one at a time. It contains a link at the bottom of the box that triggers the switch to the next slide. When the link is clicked the box shows the next slide and the height of the box changes most of the time.

                我对链接应用了 :hover 样式,但是一旦框的高度发生变化并且链接从鼠标下方移出,它就会保持其 :hover 状态直到它再次悬停.

                I have a :hover style applied to the link, however once the box's height changes and the link is moved out from under the mouse it keeps its :hover state until it is hover again.

                我尝试在更改完成后调用 .mouseleave().mouseenter().mouseleave() ,但没有任何效果.我还创建了一个不同的 :active &链接的 :focus 状态,当链接被点击时我可以看到一闪而过,但随后它返回到 :hover.:visited 样式也无效.

                I've tried calling .mouseleave() and .mouseenter().mouseleave() after the change has finished, but it doesn't have any effect. I also created a different :active & :focus state for the link, which I can see a flash of when the link is clicked, but then it returns to the :hover. A :visited style has no effect either.

                我知道在旧版本的 IE 中存在与此类似的常见错误,但我在 Chrome 和 Firefox 中也看到了这种情况.

                I know there is a common bug in older versions of IE similar to this, but I'm seeing this happen in Chrome and Firefox as well.

                这是一个 jsfiddle.

                有什么想法吗?

                推荐答案

                jsFiddle 演示

                答案很简单.当我们松开鼠标点击页面跳转显示内容,所以浏览器默认行为.注册 mouseleave 和切换类错过了.

                jsFiddle demo

                The answer is pretty simple. As we release the mouse click the page jumps to reveal content, so the browser default behav. to register mouseleave and toggle class is missed.

                以下是修复:

                CSS:

                a:active, a:selected, a:visited { /*  add his to remove stupid dotted outline */
                    border: none;
                    outline: none;
                }
                

                jQ1:

                    $('#prev-page').on('mousedown', function (e) { // use mousedown (some issues with chrome)
                        e.preventDefault();
                        showPage(pages.index($($(this).attr('href')), 600));
                    });
                    $('#next-page').on('mousedown', function (e) { // here too!
                        e.preventDefault();
                        showPage(pages.index($($(this).attr('href'))), 600);
                    });
                

                jQ2:

                pages.hide().eq(active).fadeIn(fadeTime, function () {
                    // $('#next-page').trigger('mouseleave'); // remove to fix in FF
                });
                

                这篇关于元素从鼠标下方移出后,悬停状态为粘性(在所有浏览器中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在 Chrome 开发工具中设置元素的:悬停状态并编辑孩子的样式 下一篇:css3:动画后悬停不起作用

                相关文章

                <tfoot id='6eWI2'></tfoot>

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