我正在使用jQuery script滾動頁面(div)。如果您在網址中輸入#+項目(數字),您將獲得所需的頁面(div)。但是,當瀏覽菜單時,url不會相應地改變。jQuery腳本#url更改
當我通過菜單導航腳本時,如何獲取url,以相應地進行更改?
另外,有沒有辦法讓我從url(#item02)中刪除「item」,並且只留下數字? 甚至更好,每個頁面(div)都有自定義的#名稱?
<script>
function resizePanel(){
width = $(window).width();
height = $(window).height();
mask_width = width*$(".item").length;
$("#debug").html();
$(".wrapper, .item").css({});
$(".mask").css({});
$(".wrapper").scrollTo($("a.selected").attr("href"),0)}
$(document).ready(function(){
$("a.panel").click(function(){
$("a.panel").removeClass("selected");
$(this).addClass("selected");
current = $(this);
$(".wrapper").scrollTo($(this).attr("href"),800);
return false;
});
$(window).resize(function(){resizePanel()})
})
</script>
當你正在繞過正常的書籤鏈接的行爲,你需要使用類似History.js管理瀏覽器歷史和哈希鏈接。 –