2017-05-08 9 views
0

私が所望の位置ではなく、スムーズにscrollTopスプライト.animate scrollTopスプライト作品ではなく、スムーズに

ブラウザのスクロールをアニメーション化するjQueryのコードを持っています。

<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の関数を呼び出すよう

function scrollto_aboutUsSection(){ 
// alert("about us scroll called"); 
$("html,body").animate({scrollTop: $("#aboutUs_section").offset().top }, 0.001); 
} 

そしてHTMLコードです。

bodyタグ内にhtmlコードに<?php ?>が含まれています。このJQueryファンクションもページを読み込みます。アニメーションをスムーズにスキップする理由ではありません。

PHPより前は正常でした。

+1

「0.001」はほぼゼロであることを意味しています。たとえば「500」を試してください。これは0.5秒です。 – skobaljic

+0

はい、あなたは正しいです!私はこの問題を理解し解決した。 –

答えて

1

あなたは非常に遅い速度を使用しています。ミリ秒単位の速さだ代わりに、あなたの古い0.001

の最後の値1000

$("html,body").animate({scrollTop: $("#aboutUs_section").offset().top }, 1000); 

注意:これを使用します。だから1000は1秒です。

+0

ありがとう。それは私を助けた。 –

関連する問題