Matiny
Matiny

Reputation: 179

Why is the jquery on my site malfunctioning?

Here is my site... http://matiny.tk/

The two characters (#excalibur & #black) on the side, as well as the logo (#logo) have all been selected with

$(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)'
    });
});

I've already tested the code numerous times. After I uploaded it to my site, the code stopped working both locally and remotely. The scrolling function stopped working only with the characters, but NOT with the logo... even though it's copy-pasted.

Upvotes: 0

Views: 35

Answers (1)

Mark
Mark

Reputation: 1680

Move your entire $(window).scroll() call inside of your $(document).ready() function.

Upvotes: 1

Related Questions