简体   繁体   中英

The hash of id of an anchor link is to be replaced with a slash in URL

I am having a static website built in HTML5, and having the scrolling pages. The link to the pages is specified by the help of inline anchor tag, and with the help of an Id it scrolls to the particular div and the url changes. for eg mysite.com#section1 if I move to secion 1 div.

I want to replace this # to / in the url and the page should be scrolling as well.

Can anyone please help me in achieving this.

Thanks in advance :)

你可以使用jquery或js

 url = url.replace("#", "/");

Its great that you are using HTML5.
The goodies which this great 5th version of HTML has bestowed upon us include the History API
With this API you can change the page URL (within the same domain) without redirecting/reloading.
The function is pushState .

-Relfor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM