开发者

One page website and linking

Ok guys, what I can't开发者_JAVA百科 seem to grasp is how, on a one page website, you link to certain pages/divs while using the scrollto function.

if you look at Ultranoir.com

You can see the site is built with the one page format but if you watch the url field, it navigates to subfolders etc, but is still loading all content dynamically. How do they achieve this effect while still keeping it so clean and ordered? on my current site it all stays at www.url.com/index.html even when I navigate pages. any help? thanks!


They are using hash tags to load different parts of their pages dynamically. if u add i.e. index.html#!/blog or index.html#!/about

you can parse the url client-side using javascript and load the correct content through ajax based on the url.

Check out this page to see an example implementation of this functionality using php and JQuery: http://www.queness.com/post/328/a-simple-ajax-driven-website-with-jqueryphp


They do it by abusing the fragment identifier. A modern approach would make use of pushState

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜