简体   繁体   中英

scrollTop() not working in Chrome browser

function scrollTop () {
  window.scrollBy(0, 100000000000000000);
    $("#entry").focus();
}


   function showChat (nick) {
   $("#toolbar").show();
   $("#entry").focus();

    $("#connect").hide();
    $("#loading").hide();
   scrollTop();
   }

This code not working in chrome browser but it working in Firefox, so how to use scrollTop () in safari, chrome and opera browser.

Why not use

window.scrollTo(0, 0);

?

I tested it in IE 7 and it works, also in FireFox and Chrome...

If this really don't work try using this:

function jumpScroll(amount) {
 document.body.scrollLeft += amount;
}

jumpScoll(100); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM