This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DeepChirp
committed
Nov 27, 2023
1 parent
110c664
commit 894b00c
Showing
5 changed files
with
48 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 顶端导航栏 | ||
$(function () { | ||
$("#navbar").load("navbar.html", function () { | ||
// 绑定导航栏按钮的点击事件 | ||
$('.navbar-button').click(function (e) { | ||
e.preventDefault(); // 阻止默认的页面跳转行为 | ||
|
||
// 获取要加载的页面的 URL | ||
var url = $(this).attr('href'); | ||
|
||
// 使用 AJAX 加载页面内容 | ||
$.get(url, function (data) { | ||
// 将加载的内容插入到 .content 元素中 | ||
$('.content').html(data); | ||
}); | ||
|
||
// 改变地址栏的 URL | ||
history.pushState(null, null, url); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters