Single page hide/show section based on current position

前端 未结 4 509
陌清茗
陌清茗 2021-01-15 01:40

I\'m working on a single page websites with each page organized into section tags. Every section is placed on top of each other. I need a way with jquery, where based on cur

4条回答
  •  难免孤独
    2021-01-15 02:36

    You can achieve this simply by registering hashchange callback where hash part of the current window.location is read. You can choose different DOM selection technique than id.

    
    

    Note that ids which are used for hidding and unhiding elements are also added.

提交回复
热议问题