0
下面的移動視圖中的標籤代碼和我的問題時,保持選定的選項卡我如何保持選定的選項卡,如果我點擊選定的選項卡中的任何鏈接,並去任何一個環節,當我在移動設備或瀏覽器後退按鈕回到後退按鈕單擊以選中選項卡當我點擊瀏覽器後退按鈕或移動設備後退按鈕
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function(){
$('a.tab-menu').click(function(){
if ($(window).width() < 768)
$('#tab-'+($('.tab-menu').index($(this))+1)).slideToggle("slow").siblings('div').hide('slow');
});
});
</script>
</head>
<body>
<h2 class="responsive-tab"><a href="#tab-1" class="tab-menu">tab 1</a></h2>
<div id="tab-1"> content here </div>
<h2 class="responsive-tab"><a href="#tab-2" class="tab-menu">tab 1</a></h2>
<div id="tab-2"> content here </div>
<h2 class="responsive-tab"><a href="#tab-3" class="tab-menu">tab 1</a></h2>
<div id="tab-3"> <a href="#">link here</a> </div>
</body>
</html>
你想保持標籤打開當用戶按下後退按鈕查看?爲什麼? – Cruiser
客戶要求! – user3153433
http://stackoverflow.com/questions/25806608/how-to-detect-browser-back-button-event-cross-browser – Cruiser