Grow your CSS skills. Land your dream job.

[Solved] Links trigger jquery animation

  • # February 8, 2010 at 5:17 pm

    I have an animate on my site that uses a stack of notecards with links on them. When you select the notecard it slides out. I want the user to select the link on the notecard. However, since the links are in the notecard jquery sees the user select the notecard and slides back.

    Basically, how can I tell jquery to ignore the animation when the link is selected

    Code:
    $(‘#sports’).toggle(function()
    {
    $(this).stop().animate({‘marginLeft':’450px’});
    $(‘#news’).stop().animate({‘marginLeft':’0px’});
    $(‘#announcements’).stop().animate({‘marginLeft':’0px’});
    },function()
    {
    $(this).stop().animate({‘marginLeft':’0px’});
    });
    # February 8, 2010 at 5:41 pm

    .toggle() uses .preventDefault() which keeps links and buttons from working. I need to turn that off. Any ideas?

    # February 8, 2010 at 5:46 pm

    Solved

    Code:
    $(‘a’).click(function(event)
    {
    event.stopPropagation();
    });
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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