Detect state of object from previous page

I'm working on a mobile site that is just a bunch of .html pages in structure. In the header of the site I have a simple Show/Hide button that uses jquery `toggle()` to show or hide the banner. Works perfectly but when you switch to another page obviously the banner is displayed as it can't tell that on the previous page you chose to "hide" the banner as it's rendering a new .html page. Anyways the question is with javascript, can I detect something about the previous page to indicate that the banner should be "shown" or "hidden" when loading the next page. My initial thought was to fire something like a specific hash tag which could be picked up using JS and indicate that the banner should remain hidden or shown (depending on the hash). I'm just not in love with the hash idea as it is at best an ugly hack. Any thoughts on how to detect a property of the previous page that I can then use in jquery or js to operate on the banner show/hide property?

以上就是Detect state of object from previous page的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准