user1375823
user1375823

Reputation: 105

Animated bars at scroll position

I created some animated bars with jquery. I'm only really just learning jQuery & javascript. It was working last night, the bars animated when at a certain scroll position but now it doesn't work, nothing has been changed. Anyone help me out? Or is there a better way to do it than what I'm doing?

http://jsfiddle.net/FkUYf/1/

$(document).ready(function(){
    $(document).scroll(function() {
        var top = $(document).scrollTop();
        console.log(top);
        if (top > 930) $("#html, #css").animate({width:"100%"}, 2000);
        if (top > 930) $("#javascript").animate({width:"70%"}, 2000);
        if (top > 930) $("#php").animate({width:"50%"}, 2000);
        if (top > 930) $("#mysql").animate({width:"30%"}, 2000);
        if (top > 930) $("#wordpress").animate({width:"60%"}, 2000);
    });
});

Upvotes: 0

Views: 214

Answers (1)

Starx
Starx

Reputation: 78991

You dont seem to hit that 930 margin. Its working fine with 330 margin.

http://jsfiddle.net/FkUYf/2/

Upvotes: 1

Related Questions