Home >Backend Development >PHP Tutorial >javascript - Ask a question about dribbble website

javascript - Ask a question about dribbble website

WBOY
WBOYOriginal
2016-10-11 14:23:361141browse

When I click to view the work page, the URL in the browser changes. The page does not jump, but the work details page pops up, and the work can be switched left and right. How can this effect be achieved?

javascript - Ask a question about dribbble website

javascript - Ask a question about dribbble website

Reply content:

When I click to view the work page, the URL in the browser changes. The page does not jump, but the work details page pops up, and the work can be switched left and right. How can this effect be achieved?

javascript - Ask a question about dribbble website

javascript - Ask a question about dribbble website

---Update---

After checking, changing the url is implemented through the Js method window.history.pushState(). For the API, please refer to the link description. For example, enter in the current window console:

<code>window.history.pushState('q1000', 'Title', '/q/1000');</code>
You can change the current url without reloading the page.
Changing the title is easy, just document.title='question100'
This kind of user interaction is worth learning from.

Look at the network request to see how it is implemented. I guess it's asynchronous loading? Or HTTP 2?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn