English 中文(简体)
在父双传相中进行 div 的固定效果, 但作为页面滚动在屏幕上的位置粘贴
原标题:Fixed effect of div within a parent div but position stick on screen as page scrolls

我要固定 DIV 元素, 但相对于父屏幕的 DIV 元素, 作为屏幕的重新缩放, 固定的 DIV 在父母移动/ 调整时会移动, 这样当您滚动到页面时, 它会粘贴到这个位置 。 我知道什么时候使用 cs 上的固定位置, 它会相对固定到整个屏幕上, 所以固定 div 的位置将会与您屏幕的大小相对。 我想要的是什么是粘贴或让 DIV 留在屏幕的位置上, 即使您滚动页面, 但它的位置会相对其父 DIV 容器 。 在 CSS/ Javascript/ jquery 上是否有办法这样做?

注意: 效果应该像位置: 固定在滚动页面时 DIV 不移动的位置 。

非常感谢任何答复。

问题回答

您可以使用 < code> position: 绝对 。 您应该在父 div 中嵌入 div 。 指派 < code> top: 0 , < code> left: 0

http://jsfiddle.net/VdNVd/"rel="nofollow" >这里 是演示。

如果您想要固定一个位置的 div, 是演示。

希望这有帮助





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签