tags:

views:

48

answers:

2

Here is my code. The initial fadeTo works, nothing else works.

<script type="text/javascript" />

$(document).ready(function() {

$('#ButtonBGanim').fadeTo('fast',0.5);
     $('#ButtonBGanim').mouseenter(function() {
     $(this).fadeto('fast',1.0)


     }).mouseleave(function(){
     $this.fadeto('fast', 0.1);
     });
    });


</script>

<DIV id="ButtonBGanim">                    </DIV>
+2  A: 

Should be fadeTo, not fadeto.

Should be $(this), not $this.

<script type="text/javascript" />
$(document).ready(function() {
    $('#ButtonBGanim').fadeTo('fast',0.5);
    $('#ButtonBGanim').mouseenter(function() {
        $(this).fadeTo('fast',1.0);
    }).mouseleave(function() {
        $(this).fadeTo('fast', 0.1);
    });
});
</script>
chrismjones
yeah I just noticed that... but the fixed code still doesn't run?
Jared
With these two fixes code works. Check here http://jsbin.com/ojuna
jitter
Yeah, I put up a test page on my localhost to verify it worked before I posted. Thanks jitter for adding the closing script tag.
chrismjones
haha I was linking to an old version of jquery... whoops.
Jared
A: 

In your original code you may have misspelled fadeTo() but you can also try hover like this:

<script type="text/javascript" />

$(document).ready(function() {

        $('#ButtonBGanim').fadeTo('fast',0.5);
        $('#ButtonBGanim').hover(function() {
        $(this).fadeTo('fast',1.0)


        },function(){
        $(this).fadeTo('fast', 0.1);
        });
    });


</script>
Vincent Ramdhanie