Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery不在IE中工作无法获取属性';顶部';指未定义的或空的引用_Javascript_Jquery_Internet Explorer - Fatal编程技术网

Javascript Jquery不在IE中工作无法获取属性';顶部';指未定义的或空的引用

Javascript Jquery不在IE中工作无法获取属性';顶部';指未定义的或空的引用,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,我正在使用Jquery-1.7,下面是我的Jquery代码。 它在chrome中工作,但在IE中失败 $(window).bind('scroll', function () { if ($(this).attr('scrollY') > $('#footerCenter').offset().top - $(window).height() - 60) { if ($('#earthMoonLink').hasClass('more')) {

我正在使用Jquery-1.7,下面是我的Jquery代码。 它在chrome中工作,但在IE中失败

$(window).bind('scroll', function () {
    if ($(this).attr('scrollY') > $('#footerCenter').offset().top - $(window).height() - 60) {
        if ($('#earthMoonLink').hasClass('more')) {
            $('#earthMoonLink').removeClass('more').text('earth').attr({href: '#Earth', title: 'Back to Top'});
        }

    } else {
        if (!$('#earthMoonLink').hasClass('more')) {
            $('#earthMoonLink').addClass('more').text('moon').attr({href: '#Moon', title: 'Jump to Footer'});
        }
    }
});
我在IE9和IE10上的错误率都在下面

SCRIPT438: Object doesn't support property or method 'getElementsByTagName' 
jquery.min.js, line 16 character 59008
SCRIPT5007: Unable to get property 'top' of undefined or null reference 
base.js, line 48 character 9
我很肯定

$(this).attr('scrollY')
应该是

this.scrollY

据我所知,这是一个有效的属性

错误意味着选择器
#footerCenter
不正确,并且没有返回任何可见元素。你能发布HTML来配合这个吗?(或者更好的是一个JSFIDLE)您希望代码中的
this
是什么:
$(窗口).bind('scroll'),…$(this.attr('scrollY')
?@HiTechMagic:上面的代码在chrome中工作。@Sergio:我正在尝试移动鼠标滚动页面的内容。jsFIDLE任何特定的内容