移动到命名锚后的jQuery / JavaScript的处理

编程入门 行业动态 更新时间:2024-10-26 07:37:57
本文介绍了移动到命名锚后的jQuery / JavaScript的处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在做一些jQuery处理后如何将焦点移动到不同的部分(锚点)在同一页上。

How do move focus to a different section (named anchor) on the same page after doing some jquery processing.

功能ABC()做了一些处理,之后,我需要将用户移动到部分相同的页面(进一步下跌的页面)。

Function ABC() does some processing and afterwards, I need to move the user to a section on the same page (further down the page).

推荐答案

您可以用code以下滚动屏幕到< D​​IV ID =导航> 。只要改变选择您要滚动到的元素相匹配。

You can use the code below to scroll the screen to a <div id="navigation">. Just change the selector to match the element you want to scroll to.

$('html, body').animate({ scrollTop: $('#navigation').offset().top }, 'slow');

更多推荐

移动到命名锚后的jQuery / JavaScript的处理

本文发布于:2023-08-01 20:15:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1271363.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:jQuery   JavaScript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!