gpt4 book ai didi

javascript - 滚动到下一个 div jQuery

转载 作者:太空宇宙 更新时间:2023-11-03 18:00:58 24 4
gpt4 key购买 nike

我正在研究这个 page

如您所见,在底部中间有一个箭头,现在我无法让它滚动到下一部分。

您可以通过正常滚动查看下一个元素,但我也想在箭头上激活它。

这是标记:

<a id="arrow-down" href="#" onclick="javascript:void(0);"></a>

这是我试过的:

    $('#arrow-down').on('click', function () {
var ele = $(this).closest("div").find(".project.skrollable");
// this will search within the section
$("html, body").animate({
scrollTop: $(ele).offset().top
}, 100);
return false;
});

知道我做错了什么吗?或者我怎样才能实现它?

最佳答案

我发现你在错误的地方添加了必需的 JS。 (目前在线:根据源码查看562)

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://archcase.com/wp-content/themes/archcase/js/jquery.mousewheel.js"></script><!-- the mousewheel plugin -->
<script type="text/javascript" src="http://archcase.com/wp-content/themes/archcase/js/jquery.jscrollpane.min.js"></script><!-- the jScrollPane script -->
<script type="text/javascript" src="http://archcase.com/wp-content/themes/archcase/custom_templates_css/Mullion/js/skrollr.js"></script>
<script type="text/javascript" src="http://archcase.com/wp-content/themes/archcase/custom_templates_css/Mullion/js/plugin.js"></script>
<script type="text/javascript" src="http://archcase.com/wp-content/themes/archcase/custom_templates_css/Mullion/js/main.js"></script>

将这些 js 包含添加到页面顶部。它至少应该在线:60。

关于javascript - 滚动到下一个 div jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25484592/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com