如何使元素在页面上滚动? [英] How to make element scroll with you on page?

查看:265
本文介绍了如何使元素在页面上滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网站上创建一个元素,当您向下滚动窗口时滚动。在大多数情况下,我知道这可以很容易地解决与一些基本的CSS使用固定的定位。问题是,我不想在任何时候都在屏幕上的同一个空间。我想它是一个侧边栏元素,从内容的其余部分开始,但随后随着你向下滚动页面。有关示例,请参见 http://www.demonoid.com/ (参见右侧的广告)这一页)。我知道可能有一个相当容易的css或jquery解决方案,但我没有能够想到一个。非常感谢您的帮助。

I would like to create an element on a website that scrolls as you scroll down the window. In most cases, I know this could easily be solved with some basic css using fixed positioning. The issue is, I would not like it to be in the same space on the screen at all times. I would like it to be a sidebar element that starts with the rest of the content, but then moves with you as you scroll down the page. See http://www.demonoid.com/ for an example (see the ad on the right side of the page). I know there is probably a fairly easy css or jquery solution, but I have not been able to think of one. I appreciate the help.

谢谢!

推荐答案

使用jQuery创建固定浮动元素的精彩教程:

Here's a really great tutorial to create fixed-floating elements using jQuery:

固定浮动元素| jQuery for Designers

这篇关于如何使元素在页面上滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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