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