dopatraman
dopatraman

Reputation: 13908

Can't make jQuery animation work

I am trying to make the top div fade out when it is clicked, but I can't get it to work. Here is my code:

<script type = 'text/javascript' src = '../Javascript/jquery/jquery-1.6.2.js'></script>
<script type = 'text/javascript'>
$(document).ready(function() {
    $('#topcontent').click (
        function() {
        $('#topcontent').fadeTo(300,0.0);
        }
    );
}
</script>
</head>
<body>
    <div id = 'wrapper'>
        <div id = 'topcontent'>
        TOP<br />
        </div>
        <div id = 'bottomcontent'>
        BOTTOM
        </div>
        <div id = 'sub'>
        This site is still being created. Check back soon!
        </div>
    </div>
</body>

Any ideas on why it's not working?

Upvotes: 0

Views: 60

Answers (2)

Mehdi Hadjar
Mehdi Hadjar

Reputation: 675

You just have a syntax error

$(document).ready(function() {
$('#topcontent').click (
    function() {
        $('#topcontent').fadeTo(300,0.0);
    });
});

Upvotes: 1

Will
Will

Reputation: 20235

You forgot a closing parenthesis at the end of $(document).ready(function(){});.

Upvotes: 6

Related Questions