mirror of
https://github.com/WebStackPage/WebStackPage.github.io.git
synced 2026-02-06 03:43:16 +08:00
修改定位锚点平滑移动BUG
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
|
||||
<head>
|
||||
<script>
|
||||
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
< script async src = "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" >
|
||||
</script>
|
||||
<script>
|
||||
(adsbygoogle = window.adsbygoogle || []).push({
|
||||
google_ad_client: "ca-pub-8550836177608334",
|
||||
@@ -4050,21 +4051,25 @@
|
||||
</div>
|
||||
<!-- 锚点平滑移动 -->
|
||||
<script type="text/javascript">
|
||||
// $(document).ready(function() {
|
||||
// $("#main-menu li ul li").click(function() {
|
||||
// $(this).siblings('li').removeClass('active'); // 删除其他兄弟元素的样式
|
||||
// $(this).addClass('active'); // 添加当前元素的样式
|
||||
// });
|
||||
// $("a.smooth").click(function() {
|
||||
// $("html, body").animate({
|
||||
// scrollTop: $($(this).attr("href")).offset().top - 30
|
||||
// }, {
|
||||
// duration: 500,
|
||||
// easing: "swing"
|
||||
// });
|
||||
// });
|
||||
// return false;
|
||||
// });
|
||||
$(document).ready(function() {
|
||||
$("#main-menu li ul li").click(function() {
|
||||
$(this).siblings('li').removeClass('active'); // 删除其他兄弟元素的样式
|
||||
$(this).addClass('active'); // 添加当前元素的样式
|
||||
});
|
||||
$("a.smooth").click(function(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
public_vars.$mainMenu.add(public_vars.$sidebarProfile).toggleClass('mobile-is-visible');
|
||||
ps_destroy();
|
||||
$("html, body").animate({
|
||||
scrollTop: $($(this).attr("href")).offset().top - 30
|
||||
}, {
|
||||
duration: 500,
|
||||
easing: "swing"
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
var href = "";
|
||||
var pos = 0;
|
||||
@@ -4076,23 +4081,8 @@
|
||||
e.preventDefault();
|
||||
href = $(this).attr("href");
|
||||
pos = $(href).position().top - 30;
|
||||
$("html,body").animate({
|
||||
scrollTop: pos
|
||||
}, 500);
|
||||
});
|
||||
</script>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111463289-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-111463289-1');
|
||||
</script>
|
||||
<!-- Bottom Scripts -->
|
||||
<script src="../assets/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/js/TweenMax.min.js"></script>
|
||||
|
||||
@@ -4110,36 +4110,36 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 锚点平滑移动 -->
|
||||
<script type=”text/javascript“>
|
||||
$(document).ready(function() {
|
||||
$(”#main - menu li ul li“).click(function() {
|
||||
$(this).siblings(’li‘).removeClass(’active‘); // 删除其他兄弟元素的样式
|
||||
$(this).addClass(’active‘); // 添加当前元素的样式
|
||||
});
|
||||
$(”a.smooth“).click(function(ev) {
|
||||
ev.preventDefault();
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#main-menu li ul li").click(function() {
|
||||
$(this).siblings('li').removeClass('active'); // 删除其他兄弟元素的样式
|
||||
$(this).addClass('active'); // 添加当前元素的样式
|
||||
});
|
||||
$("a.smooth").click(function(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
public_vars.$mainMenu.add(public_vars.$sidebarProfile).toggleClass(’mobile - is - visible‘);
|
||||
ps_destroy();
|
||||
$(”html, body“).animate({
|
||||
scrollTop: $($(this).attr(”href“)).offset().top - 30
|
||||
}, {
|
||||
duration: 500,
|
||||
easing: ”swing“
|
||||
});
|
||||
});
|
||||
return false;
|
||||
public_vars.$mainMenu.add(public_vars.$sidebarProfile).toggleClass('mobile-is-visible');
|
||||
ps_destroy();
|
||||
$("html, body").animate({
|
||||
scrollTop: $($(this).attr("href")).offset().top - 30
|
||||
}, {
|
||||
duration: 500,
|
||||
easing: "swing"
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
var href = ”“;
|
||||
var href = "";
|
||||
var pos = 0;
|
||||
$(”a.smooth“).click(function(e) {
|
||||
$(”#main - menu li“).each(function() {
|
||||
$(this).removeClass(”active“);
|
||||
$("a.smooth").click(function(e) {
|
||||
$("#main-menu li").each(function() {
|
||||
$(this).removeClass("active");
|
||||
});
|
||||
$(this).parent(”li“).addClass(”active“);
|
||||
$(this).parent("li").addClass("active");
|
||||
e.preventDefault();
|
||||
href = $(this).attr(”href“);
|
||||
href = $(this).attr("href");
|
||||
pos = $(href).position().top - 30;
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user