我对 JavaScript 比较陌生,我正在开发一个网站,当我单击网站的某些元素时,我希望能够切换 URL,而无需重新加载页面。
我希望它像http://www.itemcycle.com一样工作当您点击链接出售您的 iPad 或 iPhone,然后选择您的型号时。它显示不同的框,当您单击它们时,它会更改 URL,但我知道它不会加载新页面,因为它不会将我滚动回顶部。
预先感谢您的帮助!
最佳答案
您看到的是一个单页应用程序
A single-page application (SPA), also known as single-page interface (SPI), is a web application or web site that fits on a single web page with the goal of providing a more fluid user experience akin to a desktop application.
通过使用一定的JS框架来实现。 AngularJS 是最流行的一种。
关于javascript - 如何使用 JavaScript 更改页面 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37181242/