How to identify an anchor in a url in Django?

后端 未结 3 1037
猫巷女王i
猫巷女王i 2020-12-07 04:56

I\'m doing a slideshow and each slide has a url format like this: articles/1234#slide=5. I want to retrive the slide=5 part from the url in my url.

3条回答
  •  时光说笑
    2020-12-07 05:06

    You hit on it in your question. The anchor part of the URL is not passed to the server, it is only used client side. Why not use standard get parameters:

    articles/1234?slide=5
    

    Since you are stuck with this url format, you might want to use a animated scroll of some kind which might make this less annoying, checkout the answers to this question jquery smooth scroll to an anchor?

提交回复
热议问题