Grow your CSS skills. Land your dream job.

jQuery nav animate!

  • # January 15, 2011 at 12:21 pm

    How come this doesn’t work!!












    # January 15, 2011 at 1:11 pm

    In the demo code given there is no CSS. If the ‘a’ element does not have ‘position: relative’ it cannot move.

    Also when you mouse over the element you then end up targeting ALL ‘a’ elements. For mouseout you may want to chain events.

    This code *might* work (providing that ‘a’ elements are relatively positioned):

    $(document).ready(function(){
    $("#nav ul li a").mouseover(function(){
    $(this).animate({left:10},"fast")
    }).mouseleave(function(){
    $(this).animate({left:0},"fast")
    });
    });

    You may be able to achieve this better in CSS alone too. Just a thought!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".