Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript can someone tell me what i’ve done wrong with this following code

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #32575
    mshort1985
    Member

    Hi all, this jQuery code i wrote isn’t working, its telling me there is a syntax error on the line with “$(this).animate({” but I don’t see it.

    $(document).ready(function(){

    $("#navigation li a").hover({

    $(this).animate({

    border-bottom-left-radius: '0',
    border-top-right-radius: '0',
    border-top-left-radius: '20px',
    border-bottom-right-radius: '20px',

    }, 5000);

    });

    });

    #47912
    $(document).ready(function(){
    $("#navigation li a").hover(function() {
    $(this).animate({"border-radius":"20px 0"}, 5000);
    });
    });

    5000 seems like a long time for a hover effect.

    #47913
    mshort1985
    Member

    sadly that doesn’t work either :(

    #47914

    yes it does, are you loading jqeury? The 5000 puts a 5 second delay on the effect.

    #47915
    mshort1985
    Member

    yes i’m loading jquery, the console keeps telling me theres a syntax error

    #47916

    then its in some other part of your script, console.log in firebug to troubleshoot it i guess.

    #47917
    mshort1985
    Member

    I copied and pasted my entire script onto this thread, so what you see is my entire script.

    #47918

    This is my test doc and its working here.





    js border radius







    #47870
    TT_Mark
    Member

    In your script I don’t think you should have that last comma after the bottom-right radius line

    #47651
    Josh
    Member

    I should note that the .hover() is made to control both the MouseOver and MouseLeave events. If you’re only using it for a MouseOver i suggest using .mouseover()

    $().hover(
    function(){
    // on mouse over code
    },
    function(){
    // on mouse leave code
    });
    #47278
    mshort1985
    Member

    Thanks all,

    I got it working in the end


    @josh
    , i was planning to add a mouse out event also i just kept it simple to start with to weed out any issues.

    Thanks again all.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.