通过页面更改保持div打开? [英] Keep div open through page changes?
问题描述
我一直在尝试让一个div'footer'留在页面底部,并通过页面更改保持打开。我已经通过在主内容div上使用JQuery的.load函数实现了这一点,但是,使用该方法,当有人转到不同的页面时,URL保持不变。有没有办法保持链接更改URL,但保持div打开?我计划通过div播放音乐,所以它不能在页面切换之间关闭,或音乐将停止/必须重新缓冲。
I've been trying to have a div 'footer' stay at the bottom of the page, and stay open through page changes. I have achieved this by using JQuery's .load function on a main content div, however, using that method, when someone goes to a different page, the URL stays the same. Is there a way to keep the links changing the URL, but keep the div open? I plan on playing music through said div, so it can't close between page switches, or the music will stop/have to rebuffer.
推荐答案
你可以使用HTML5来做到这一点:
You can do this with HTML5 using:
window.history.pushState(obj, "Title", url);
<
after your .load()
call.
它会将显示的网址更改为与调用中的网址匹配,但只允许属于同一域的网址。
It'll change the displayed URL to match the one in the call, but only URLs that belong to the same domain are permitted.
请参阅 https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history
这篇关于通过页面更改保持div打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!