鼠标悬停时jQuery Position Element彼此相邻 - 固定可滚动div [英] jQuery Position Element next to each other on mouse over - with fixing of scrollable div

查看:85
本文介绍了鼠标悬停时jQuery Position Element彼此相邻 - 固定可滚动div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我摆弄了这个
jsFiddle of mouseover with absolute positioning divs

结果是不受欢迎的。该代码基于 jquery如何将一个元素相对于另一个元素定位
但是代码没有按预期工作。我可以弄清楚如何根据绝对定位重新定位偏移(例如标头的减法偏移)。但我遇到的麻烦是滚动定位。一旦开始滚动,位置就错了。有人知道它的解决方案吗?

The outcome is undesired. The code is based on jquery how to position one element relative to another But the code is not working as expected. I can figure out how to reposition the offset depending on the absolute positioning (e.g. substract offset of header). But what I have trouble with is the scrolling positioning. As soon as you start scrolling the position is wrong. Does someone know a solution of it?

推荐答案

讨厌回答我自己的问题,但请看这里:
使用jquery的工作解决方案

hate to answer my own questions but see here: working solution with jquery

基本上问题在于元素被插入错误的位置。偏移量在某种程度上与滚动条的页面没有正确关联。这可以通过在父窗体上添加元素来修复(例如,如果您想要显示某些按钮)。或者< body>

basically the problem was that the element was inserted at the wrong location. The offset somehow did not relate correctly to the page with scrollbars. This can be fixed by adding the element on the parent form (in case you wanna make some buttons visible for example). Or the <body>

它修复了我所拥有的重叠元素的问题。想象一下,你有一个固定定位元素E1和一个绝对定位元素E2。一个是左侧菜单,E2是内容。当你想鼠标移过一个元素时想要显示/显示一个元素在E2内容中div并希望它在左侧菜单E1上重叠,那么你需要确保div不在内容中,因为它似乎不能重叠到定位固定的E2兄弟中。

It fixes as well a problem with overlapping elements I had. Just imagine you have an fixed positioned element E1 and an absolute positioned element E2. One is the left menu, E2 is the content. When you want to make visible / show an element when you mouseover over a e.g. div in the E2 content and want it to overlap over the left menu E1 then you need to make sure that the div is not in the content, since it seems you cannot overlap into a sibling of E2 which is positioned fixed.

这篇关于鼠标悬停时jQuery Position Element彼此相邻 - 固定可滚动div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆