查询scrollTo在Firefox中不起作用 [英] query scrollTo does not work in Firefox

查看:237
本文介绍了查询scrollTo在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在正在构建的页面中使用scrollTo jquery库,它可与Chrome,Safari和IE 8/9一起使用,但不适用于Firefox.萤火虫告诉我,

I'm using the scrollTo jquery library in a page I'm building, and it works with Chrome, Safari, and IE 8/9, but not with firefox. Firebug tells me,

TypeError:$(#wrapper").scrollTo不是函数

TypeError: $("#wrapper").scrollTo is not a function

这是包含scrollTo库的行

Here is the line that includes the scrollTo library

<script type="text/javascript" src="js/jquery.scrollTo.js"></script>

这是我使用scrollTo的功能

Here is the function where I use scrollTo

function scrollPage(currentpage,scrollpage) {
    $(scrollpage).find('.text').fadeOut();
    $(currentpage).find('.text').fadeOut( function(){
        $('#wrapper').scrollTo( scrollpage, 1500, {
            onAfter:function(){
                $(scrollpage).find('.text').fadeIn();
            }
        });
    });
}

为什么我尝试过的所有其他浏览器都无法将firefox认为scrollTo是一个函数?

Why would firefox not think scrollTo was a function, while all other browsers I've tried do?

看来我的文件可以在其他计算机上使用,但不能在当前的firefox安装上使用.我将重新安装并看到有帮助.

It seems that my files work on other computers, but not on my current install of firefox. I am going to re-install and see that helps.

推荐答案

解决方案:

好吧,看来是弹出窗口阻止程序引起了冲突! OP发现Kaspersky在firefox中安装了一个安全附件,并阻止了scrollTo.

Well, it seems a popup blocker caused a conflict! The OP found that Kaspersky installed a security add on in firefox, and was blocking scrollTo.

更多: http://github.com/mootools/mootools-core/issues/2202

原始帖子:

当我的jQuery代码未包含在$(document).ready(function() {...your jquery statements here ...});块中时,有时会出现该错误.

I sometimes get that error when my jQuery code is not enclosed in a $(document).ready(function() {...your jquery statements here ...}); block.

您的函数不必在文档内部即可使用,但调用它的语句应该在其中.

Your function doesn't have to be inside doc ready but the statement that calls it should be.

这篇关于查询scrollTo在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆