jQuery技术:停止在hoverjQuery上更改偏移量

我想在浏览器窗口的左侧创建一个小条,它跟踪鼠标的Y位置并跟随鼠标。 到目前为止,没有问题。

但是现在我想在鼠标hover在div上时阻止div偏移,以便也可以点击div刚刚显示的内容。

我做了一个小提琴,让自己清楚

https://jsfiddle.net/UXWp6/

    $(document).bind('mousemove', function(e){ $('#blokje').offset({top: e.pageY-100}); });   #blokje{width:200px; height:200px; background:white; position:relative; left:-180px; color:black; } #blokje:hover{left:0;} #blokje #tit{position:absolute; width:30px; height:200px; background:black; right:0; top:0; }    
&nbsp

A link
This is the content where I would like to have my content clickable like that link on top

    而不是一遍又一遍地实际绑定和解除事件。 我可能只是停止传播,所以文档永远不会发生。

     $(function(){ $(document).bind('mousemove', function(e){ $('#blokje').offset({top: e.pageY-100}); }); $('#blokje').bind('mousemove', function(e){ e.stopPropagation(); }); }); 

    提琴手

      以上就是jQuery教程分享停止在hoverjQuery上更改偏移量相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/547543.html

      (0)
      上一篇 2021年1月11日
      下一篇 2021年1月11日

      精彩推荐