javascript - Add animation to scrolling down to a specific div in jquery -


hello there i'm using following code scroll bottom @ specific div, , working fine but, speedy, want scroll specific element, know can jquery , i've been trying different codes hours now, can please me respect code, thankyou.

<script> $(document).ready(function(){ $(".cat-anchor").click(function(){     $('html','body').animate({scrolltop: $(".cat-title").offset.top},'slow'); }); }); </script>  <div class="bran-cat">         <h2>category</h2>         <div class="cat-list">             <?php                 foreach($cat_arr['cat_pro'] $cat_name){                     echo "<a class='cat-anchor'>".">".$cat_name[1]."</a> <br>";                 }                 //$sel_cat= $wpdb->get_results("select * ");             ?>         </div> </div> <?php      foreach($cat_arr['cat_pro'] $mykey=>$myvalues){        echo '<div name="'.$myvalues[1].'" class="cat-title" id="'.$myvalues[0].'"><h2>'.$myvalues[1].'</h2></div>'; ?> 

to scroll specified element use jquery animate().

$('body').animate({   scrolltop: $('#target-element').offset().top }, 500); 

last argument duration of animation.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -