Html 浏览器后退按钮在隐藏div和x27之间断开;s
首先,这些页面永远不会在web上,而是在内存中。它们是一组链接的文档——一本电子书 当我单击第一个div中的链接时,第二个div变为可见,第一个div被隐藏。问题在于浏览器的“后退”按钮。如果单击“上一步”按钮,URL将更新,但第一个div不会再次显示。如何更正“后退”按钮以显示第一个div?从第二个div到第一个div的链接工作正常,但我不知道如何使用浏览器后退按钮 谢谢, 琳达 注意:这些都使用CSS3,因此最好使用基于WebKit的浏览器。试试这个:Html 浏览器后退按钮在隐藏div和x27之间断开;s,html,css,Html,Css,首先,这些页面永远不会在web上,而是在内存中。它们是一组链接的文档——一本电子书 当我单击第一个div中的链接时,第二个div变为可见,第一个div被隐藏。问题在于浏览器的“后退”按钮。如果单击“上一步”按钮,URL将更新,但第一个div不会再次显示。如何更正“后退”按钮以显示第一个div?从第二个div到第一个div的链接工作正常,但我不知道如何使用浏览器后退按钮 谢谢, 琳达 注意:这些都使用CSS3,因此最好使用基于WebKit的浏览器。试试这个: jQuery插件的方式是每隔100毫
jQuery插件的方式是每隔100毫秒检查一次当前URL,一旦哈希部分发生变化,它就会使用回调函数触发内容的重置。这是相当低效和粗糙的,但我不认为有其他方法。可以通过将此脚本添加到头部来完成此操作:
<script>
var lastHash = window.location.hash || "nothing";
setInterval(function() {
if (lastHash != window.location.hash) {
if (window.location.hash == '#offscreen') {
document.getElementById('offscreen').className = 'slideInFromRightToLeft';
document.getElementById('div1').className = 'slideLeftOut imInvisible';
} else {
document.getElementById('offscreen').className = 'slideRightOut imInvisible';
document.getElementById('div1').className = 'slideInLeftToRight';
}
}
}, 100);
</script>
var lastHash=window.location.hash | |“nothing”;
setInterval(函数(){
if(lastHash!=window.location.hash){
if(window.location.hash='#屏幕外'){
document.getElementById('offscreen')。className='slideInFromRightToLeft';
document.getElementById('div1')。className='slideLeftOut-imInvisible';
}否则{
document.getElementById('offscreen')。className='slideRightOut-imInvisible';
document.getElementById('div1')。className='slideInLeftToRight';
}
}
}, 100);
通过这种方式,您还可以删除onClick处理程序并将所有逻辑放在该函数中。我认为最好的选择是使用以下代码:
$(window).load(*GetSelectedItem*);
GetSelectedItem示例函数如下所示:
function GetSelectedItem()
{
var chosen = "";
var len = document.signUpFrm.frmUserChoiceForActionPropertyType.length;
$('#display_spacer').hide();
$('#display_industry_type').hide();
document.signUpFrm.industry_type.value = '-1';
$('#display_warehouse_type').hide();
document.signUpFrm.warehouse_type.value = '-1';
$('#display_commercial_type').hide();
document.signUpFrm.commercial_type.value = '-1';
for (i = 0; i <len; i++)
{
if (document.signUpFrm.frmUserChoiceForActionPropertyType[i].checked)
{
chosen = document.signUpFrm.frmUserChoiceForActionPropertyType[i].value;
showHideErrorMsg('frmUserChoiceForActionPropertyType','',0);
}
}
if (chosen == "")
{
alert("No Location Chosen");
}
else if (chosen == "Industry")
{
$('#display_spacer').show();
$('#display_industry_type').show();
}
else if (chosen == "Warehouse")
{
$('#display_spacer').show();
$('#display_warehouse_type').show();
}
else if (chosen == "Commercial")
{
$('#display_spacer').show();
$('#display_commercial_type').show();
}
}
函数GetSelectedItem()
{
var=”;
var len=document.signUpFrm.frmuserchoicefraction属性type.length;
$(“#显示间隔符”).hide();
$(“#显示_行业_类型”).hide();
document.signUpFrm.industry_type.value='-1';
$(“#显示_仓库_类型”).hide();
document.signUpFrm.warehouse_type.value='-1';
$(“#显示_商业_类型”).hide();
document.signUpFrm.commercial_type.value='-1';
对于(i=0;我轮询哈希是唯一的方法。window.location.hash是否不是普遍可用的?这是一个小问题,但更易于使用。它已被更改以反映这一点。我肯定会尝试一下。您甚至使用了我的CSS类,这很有帮助。非常感谢您的努力。LindaJust重新检查,我似乎找不到通用的专业版问题(在Chrome和Firefox中测试),但返回到第一个未删除的页面时它不起作用(在上次编辑中修复)。这就是stackoverflow.com的用途。:)