滚动到单一帖子 [英] Scroll to Single Post

查看:56
本文介绍了滚动到单一帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个关于Wordpress的网站,需要有点像流畅的单页布局。

I'm currently developing a website on Wordpress that requires sort of like a fluid single page layout.

开发索引,单个帖子和类别的自定义模板页面是轻而易举的,但是以这样的方式实现它:当用户点击帖子并且网站向下滚动以显示单个帖子自定义模板时不是。

Developing the custom templates for the index, single post and category pages is a breeze, but implementing it in such a way that when the user clicks on a post and the site scrolls downwards to display the single post custom template is not.

这是一个展示此功能的参考站点 - Nike Free Voice 。基本上发生的是,如果你点击一个图像,该网站将向下滚动以显示实际的文章/帖子。

This is a reference site demonstrating this function - Nike Free Voice. What basically happens is that if you click an image, the site will scroll down to reveal the actual article/post.

我认为最合适的方式是使用AJAX将内容加载到DIV中,然后使用JQUERY将页面向下滚动到该特定DIV。这里的问题是:我该怎么做?

I'm supposing that the most appropriate way is to use AJAX to load the content into a DIV and then have JQUERY to scroll the page down to that particular DIV. Question here is: How do I do that?

我还考虑向下滚动到IFRAME,但将IFRAME源定位到single.php文件或实际永久链接将无法正常工作 - 对于前者只是呈现错误而对后者这样做将意味着加载的内容不是动态的,因为它是永久链接的绝对链接。

I've also considered scrolling down to an IFRAME but targeting the IFRAME source to the single.php file or the actual permalink won't work - doing so for the former just renders an error and doing so for the latter will mean that the content loaded in isn't dynamic because it is an absolute link to the permalink.

真的希望周围的人知道从哪里开始。

Really hope someone around would have an idea of where to start.

先谢谢你们!

PS:我没有发布任何示例代码,因为Wordpress的基础结构非常标准。这只是加载正确的单个帖子内容然后滚动到它的问题。

PS: I haven't posted any sample codes because the infrastructure of Wordpress is pretty much standard. It's really just the matter of loading in the right single post content and then scrolling to it.

推荐答案

我已经解决了这个问题在另一篇文章中(使用AJAX / JQUERY将Word内容加载到DIV中)专门针对使用AJAX和JQUERY加载内容,基于Emanuele Feronato的发布

I've resolved the issue at another post (Load Wordpress post Content into DIV using AJAX / JQUERY) that was specifically targeted at loading the content in using AJAX and JQUERY based on Emanuele Feronato's post

这篇关于滚动到单一帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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