Question: Scroll using id then it jumps the page when come to anchor id div. This is my code for it.:

```
jQuery('#menu-item-46 a').click(function(){ 
    jQuery('html, body').animate({
        scrollTop: jQuery('#news').offset().top        
    }, 2000);   
}); 

```

Answer: 
If your anchor's `href` specifies an `id` of an element within your DOM, your page will adjust your view-ports scroll position to place that element at the top (or as close as possible). This behaviour occurs before JavaScript proceeds to animate your `scrollTop` property.

Prevent the default behaviour of your anchor to stop this:

```
jQuery('#menu-item-46 a').click(function(e){
    e.preventDefault();
    jQuery('html, body').animate({
        scrollTop: jQuery('#news').offset().top        
    }, 2000);   
});

```

[**JSFiddle**](http://jsfiddle.net/ap7uc4xb/)
Anchors default redirects you immediately, but if you want to do animations with javascript, deves disable the default behavior using the **event.preventDefault()** and then run the animation. 

Ohter example <http://jsfiddle.net/okco0069/>

```
<select id="menu-item">
    <option value="news1">News1</option>
    <option value="news2">News2</option>
    <option value="news3">News3</option>
</select>

<a href="#anchor1">#anchor1</a>
<a href="#anchor2">#anchor2</a>

<h1>Lorem</h1>
<p>Lorem ipsum dolor sit amet, <a href="#anchor1">anchor1</a> adipisicing elit. 
   Rem neque corporis hic possimus, repellendus illo eaque molestiae atque numquam   
   deserunt officiis beatae.
</p>
<p>
  <a href="#anchor2">  modi similique veritatis eligendi quaerat, inventore ipsam?
  Deleniti.....
</p>

```

```js
jQuery(document).ready(function ($) {
    $("#menu-item").change(function (event) {
        var id_element = "#" + $(this).val();
        var element = $(id_element);
        scroll_to_element(element);
    });

    $("a").click(function (event) {
        event.preventDefault(); //the default action of the event will not be triggered.
        var id_lement = $(this).attr('href');
        var element = $(id_lement);
        scroll_to_element(element);
    });

    function scroll_to_element(element) {
        $("html , body").animate({
            scrollTop: element.offset().top
        }, 2000);
    }
});

```