Jquery地址插件 - 历史(后退/前进)跟踪无效
我一直试图让Jquery地址插件正常工作大约12个小时,因此我想到了发布的时间。我遇到的问题是后退和前进导航无法正常工作。 IE:点击链接,然后单击后退按钮实际上不会导航回来。它改变了网址。另一件让我相信我做了一些根本错误的事情是我插入了
$.address.title($(this).attr("title"));
并且实际上并没有改变地址。
Jquery在这里:
$('#swNavlist a').address();
$('#swNavlist a').click(function() {
$("#swBody").block({
message:"Loading",
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
} });
var content_show = $(this).attr("href").replace(/^#/, '');
$.ajax({
method: "get",url: content_show,
//"+bvLanguage+"/
success: function(html){ //so, if data is retrieved, store it in html
$("#swBody").html(html); //show the html inside .content div
$("#swBody").unblock();
$.address.title($(this).attr("title"));
},//success
error: function(){
$("#swBody").unblock();
$("#swBody").block({
message:"Error Encountered",
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
},
timeout:1000
})
}
}); //close $.ajax(
$("#swNavlist").topZIndex();
});//end navigation
HTML在这里:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<Title>Swebits Home</title>
<link href="css/swCss.css" rel="styleSheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.pngFix.js"></script>
<script type="text/javascript" src="js/jquery.blockUI.js"></script>
<script type="text/javascript" src="js/jquery.topzindex.min.js"></script>
<script type="text/javascript" src="js/sw.js"></script>
<script type="text/javascript" src="js/jquery.address-1.3.2.min.js?autoUpdate=1"></script>
</head>
<body>
<div id="swHead">
<div class="leftCol"></div>
<div class="centerCol">
<div class="navigation">
<ul id="swNavlist">
<li id="active"><a href="#home.html" id="current" title="Swebits Home">Home</a></li>
<li><a href="#webd.html" title="Swebits Web Development">Web Design</a></li>
<li><a href="#bla.html" title="webs.html">Web Systems</a></li>
<li><a href="" title="hosting.html">Hosting</a></li>
<li><a href="" title="photo.html">Photography</a></li>
<li><a href="" title="portfolio.html">Portfolio</a></li>
<li><a href="" title="network.html">Our Network</a></li>
<li><a href="" title="contact.html">Contact</a></li>
</ul>
</div>
</div>
<div class="rightCol"></div>
</div>
<div id="swContainer" class="clearfix">
<div id="swCenter" class="clearfix">
<div id="swBody">
<?php
include("home.html");
?>
</div>
<div id="swFooter">
</div>
</div>
</div>
</body>
最后,我尝试实现一个if语句,这样如果目标为空,页面重定向到'error.html',但这似乎也不起作用。
我很感激帮助!
没有找到相关结果
已邀请:
2 个回复
羔磺
号拳藐孔妇
和里面使用JQ地址
属性(深层链接后的值)
)设置要加载AJAX的正确页面。 现在你告诉JQ地址你当前的页面状态是什么,但你没有告诉它该如何处理这个值,你自己做了更改,所以当你输入正确的URL或使用时,JQ地址无法生成它们后退按钮。