jquery使用slideto时如何偏移顶部

发布于 2024-10-09 21:48:04 字数 247 浏览 0 评论 0原文

我可以让页面滑动到我想要的 div,但我希望 div 从顶部偏移 25 px,任何人都知道修复我的代码

$('#project_btn').bind('click', function() {
$('html, body').animate({
scrollTop: $("#project_page").offset().top
},1000);
});

也有人知道如何让我的菜单栏始终保持不变停留在页面顶部?

I can get the page to slide to the div i want, but i want the div to be offset from the top by 25 px, anyone have any idea of to fix my code

$('#project_btn').bind('click', function() {
$('html, body').animate({
scrollTop: $("#project_page").offset().top
},1000);
});

Also does anyone know how i could get my menu bar to always stay at the top of the page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七颜 2024-10-16 21:48:04

我有点不确定你想要什么,但是看看这个例子?: http://jsfiddle.net/拉森/cMTMm/

I am a little unsure of what you are wanting, but look at this example?: http://jsfiddle.net/lathan/cMTMm/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文