jQuery 根据滚动位置更改 div 中的内容
我正在 WordPress 中构建一个博客页面,并添加一个指向当前帖子的侧边栏。我想使用 jQuery 用当前帖子的日期填充该侧边栏。这只是一个想法,所以我没有任何代码。但它的功能如下:
当您向下滚动页面时,日期(或其他信息)会发生变化基于你旁边的div。它还必须在博客设置中工作,这意味着每个 div 可能有不同的高度。
有什么想法吗?
I am building a blog page in Wordpress and adding a sidebar that points to the current post. I'd like to fill that sidebar with the date of the current post using jQuery. It's only an idea so I don't have any code. But it would function like this:
As you scroll down the page the date (or other info) would change based on which div you were next to. It also has to work in a blog setting meaning each div can potentially be a different height.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你想从哪里获取日期,所以,只是一个例子.. http://jsfiddle.net/ Nsubt/ Div 可以有固定位置,或者您可以使用
scroll
和resize
事件更新其在块中的绝对位置。右侧的
I do not know where you want to get the date from, so, just an example.. http://jsfiddle.net/Nsubt/
Div on the right could have a fixed position or you can update its absolute position in the block working with
scroll
andresize
events.