Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm required to use a website for school that scrolls the page whenever you click an inputbox. Is there a way to disable JS from scrolling the page?

I've found the section of JS that does the scrolling.

  // Automatically scroll to inputs when they gain focus. Do not do this for Partner Chat, where there is only one input.
  $('#activity_shell').find('input').each(function(){
    if ($(this).attr('type') == 'text') {
      $(this).focus(function(){ $('html, body').animate({scrollTop: ($(this).offset().top) - 200}, 200); });
    }
  });
share|improve this question
up vote 2 down vote accepted

Use CTRL+SHIFT+K to open the developer tools. Then run the following code in the console:

window.scrollTo = window.scrollBy = window.scroll = function() {};

This replaces all JavaScript functions that can be used for scrolling with a new function that does nothing.


Since you now posted the code there is a much easier way - simply unbind the focus event that triggers the scrolling:

$('#activity_shell input:text').unbind('focus');
share|improve this answer
    
Hmm, that didn't work. – Avery3R Sep 30 '13 at 0:12
    
I added the section of JS that does the scrolling. – Avery3R Sep 30 '13 at 0:20
    
Ah.. it modifies the scrollTop property directly.. that makes it tricky. – ThiefMaster Sep 30 '13 at 11:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .