向下滚动到网页上不同 div 部分的 html/css 按钮 [英] html/css buttons that scroll down to different div sections on a webpage

查看:19
本文介绍了向下滚动到网页上不同 div 部分的 html/css 按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我搜索 css/html 代码示例:

Can someone help me I'm searching for css/html code example:

我有一个带有 3 个按钮(顶部、中间、底部)的网页,每个按钮都指定给我页面上的 1 个 div 部分,假设我的第一个 div 部分位于该页面的中间 div id='middle'.

I have a webpage with 3 buttons(top, middle, bottom) each specified to 1 div section on my page, lets say my first div section is in the middle of that page div id='middle'.

如果我点击这个按钮(中间),我的页面会自动从顶部向下滚动我的页面到 div #middle 部分.

If I click this button(middle) my page would automatically scroll down from the top of my page to the div #middle section.

对于引用 div id='top' 和 div id='bottom'

same for the other buttons refered to div id='top', and div id='bottom'

谢谢转发!我真的在互联网上找不到任何解决方案.

Thanks in forward! I really couldnt find any solution on the internet.

有没有办法让我的按钮列表保持在一个固定的位置,这样它就可以在屏幕上停留移动部分?

Is there a way to keep my buttonlist on a fixed position so it stays on screen while moving through sections?

推荐答案

对于一些非常基本的事情,请使用:

For something really basic use this:

<a href="#middle">Go To Middle</a>

或者对于 javascript 中的一些简单内容,请查看这个 jQuery 插件 ScrollTo.对于平滑滚动非常有用.

Or for something simple in javascript check out this jQuery plugin ScrollTo. Quite useful for scrolling smoothly.

这篇关于向下滚动到网页上不同 div 部分的 html/css 按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆