【发布时间】:2017-10-06 22:14:20
【问题描述】:
我有 JQuery 代码来动画 ScrollTop
浏览器滚动到所需位置但不流畅。
function scrollto_aboutUsSection(){
// alert("about us scroll called");
$("html,body").animate({scrollTop: $("#aboutUs_section").offset().top }, 0.001);
}
HTML代码如下
<div id="container">
<?php include("Includes/header&nav.html"); ?>
<div id="content">
<?php include("Includes/information_section.html"); ?>
<section id = "aboutUs_section" class="Section">
<h2 class="textShadow big_h2_font"> About Us </h2>
<p class="textShadow"> In 1987, Our founders laid the foundation of jewellery store in Gakhar Plaza, Saddar, Rawalpindi. Since that time we are in service in presentation of artistic jewels by the hands of talented craft persons and skilled artists. We still try our best to come up with ideas that matches with yours most, keeping the eye on craftmanships side by side. We deal in 21K, Embedded and non Embedded Jewels generally.
</br></br>If you are looking for 22K, we take orders as well.
</br></br>Visit our Gallery and have a look at our Jewels Range. </p>
</section>
</div> </div>
其他函数调用此 JQuery 函数。
我已在 body 标记内的 html 代码中包含 <?php ?>。这个 JQuery 函数 也会在页面加载时调用。所以不是它顺利跳过动画的原因。
在 PHP 之前,它运行良好。
【问题讨论】:
-
给动画一些时间
0.001意味着几乎为零...例如尝试500,也就是半秒。 -
是的,你是对的!我理解并解决了问题
标签: javascript jquery jquery-ui