Smooth Scrolling issue (bug)

By design Issue #7506700


Nicolas D.
May 10, 2016
This issue is public.
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce


I’m using a code to get a smooth scrolling with Javascript and in IE and Edge it doesn’t work like expected.

I use this code :

$('a[href^="#"]').on('click’,function (e) {

    var target = this.hash;
    var $target = $(target);
    var i = $(this).attr("href");
    var k = $(i).offset().top;
    $('html, body').stop().animate({
        scrollTop: k - 150
    }, 1800, 'swing' ,function () {
        window.location.hash = target;

If I remove the last function with window.location.hash, it work and stop 150px on top of section id (k-150), but if I have this function added, it stop at 150px on top and right after it go to section like if you don’t have smooth scrolling. It’s like that when it add the # in the URL it go to anchor link without just adding it in URL.

Try in Chrome vs Edge or IE.

My website (currently WIP)


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Rick J.”

      Changed Assigned To from “Rick J.” to “Ibrahim O.”

      Changed Assigned To to “Rick J.”

    • Hello,

      Same in here, the smooth scrolling works fine with other browsers and with Edge too, but if i add the #anchorname to the URL it just jumping there after the smooth scroll.

      var $root = $('html, body');
      $('.navbar-nav a').click(function() {
          var href = $.attr(this, 'href');
              scrollTop: $(href).offset().top - 50
          }, 500, function () {
              //window.location.hash = href; <- this guy kills it if i put it back
          return false;

      I really want to optimize to Edge.

    • Microsoft Edge Team

      Changed Status to “By design”

    • Setting window.location.hash is expected to scroll the element to the top of the viewport. Chrome actually does do this if you set a breakpoint on the window.location.hash set and then step over it.

    You need to sign in to your Microsoft account to add a comment.

    Sign in