为什么我网站上的jquery出现故障?

时间:2015-05-22 18:13:02

标签: jquery css

这是我的网站...... http://matiny.tk/

侧面的两个字符(#excalibur& #black)以及徽标(#logo)都是用

选择的
$(window).scroll(function () {
    var theNumber = $(this).scrollTop();

    $('#excalibur').css({
        'transform': 'translateY(' + theNumber / 2 + 'px)'
    });
    $('#black').css({
        'transform': 'translateY(' + theNumber / 2 + 'px)'
    });
    $('#logo').css({
        'transform': 'translateY(' + theNumber/1.5 + 'px)'
    });
});

我已经多次测试过代码了。在我将其上传到我的网站后,代码在本地和远程都停止了工作。滚动功能仅停止使用字符,但不使用徽标...即使它是复制粘贴的。

1 个答案:

答案 0 :(得分:1)

将您的整个$(window).scroll()电话移至$(document).ready()功能。