在fiefox中滚动页面禁用javascript


0

我需要使用一个学校的网站,只要你点击一个输入框就滚动页面。有没有办法禁止JS滚动页面?

我找到了JS的滚动部分。

  // 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); });
    }
  });

Answers:


3

使用CTRL+ SHIFT+ K打开开发人员工具。然后在控制台中运行以下代码:

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

这将替换所有可用于滚动的JavaScript函数,这些函数不执行任何操作。


由于您现在发布了代码,因此有一种更简单的方法 - 只需取消绑定触发滚动的焦点事件:

$('#activity_shell input:text').unbind('focus');

嗯,那没用。
Avery3R 2013年

我添加了滚动的JS部分。
Avery3R 2013年

啊..它scrollTop直接修改了属性..这使得它变得棘手。
ThiefMaster 2013年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.