HTML:
<html>
<head>
</head>
<body>
<a class='img' href="img1">Image 1</a>
<a class='img' href="img2">Image 2</a>
<div class="image-viewer" style="display:none"><p></p>
<a class="close" href="">Close</a>
</div>
</body>
</html>
JS:
$(function() {
var begin=location.href;
$(".img").on('click', function(e) {
console.log(location.href);
var href = $(this).attr("href")
History.pushState({"state": href, "rand": Math.random()}, "", href);
console.log(location.href);
e.preventDefault();
});
History.Adapter.bind(window, 'statechange', function() {
$(".image-viewer p").html(History.getState());
$(".image-viewer").show();
});
$(".close").click(function(e) {
e.preventDefault();
console.log($(this).parent());
$(this).parent().fadeOut(1);
History.pushState({"state": begin, "rand": Math.random()}, "", begin);
});
})
http://jsfiddle.net/rAxAw/2/
隨意問任何Q-ñ如果需要futher幫助
任何代碼? jsfiddle? –
它會是這樣的:[鏈接](http://jsfiddle.net/rAxAw/) (我沒有檢查過,我的代碼中的所有內容都是正確的,但是歷史概念在那裏)。 當你點擊圖片鏈接它應該顯示的瀏覽器,當我點擊的緊密聯繫我想要的地址回去/ – charly