Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

JQuery redirect After bounce animation

jquery redirect animation

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 vaironl

vaironl

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 138 posts

Posted 19 December 2012 - 07:42 AM

I want a bounce animation to be shown when the user clicks on a link, which has been successfully implemented below.
But the problem is that the page redirects me to fast and the bounce animation is not displayed.
How could I fix this?

$(document).ready(function()
{
    $("a").click(function()
  {
   $(this).effect("bounce", { times:2 }, 300);
  });
});


#2 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts

Posted 19 December 2012 - 07:47 AM

http://api.jqueryui.com/effect/

.effect( effect [, options ] [, duration ] [, complete ] )


You should be able to pass a4th parameter, a function to the effect method.
Inside the method you can perform the redirect.
Don't use an <a> tag, but a <span> instead. (otherwise you must write code to preven the default action of the <a> tag, which is avoidable)

Edited by wim DC, 19 December 2012 - 07:47 AM.


#3 vaironl

vaironl

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 138 posts

Posted 19 December 2012 - 09:13 AM

http://api.jqueryui.com/effect/


You should be able to pass a4th parameter, a function to the effect method.
Inside the method you can perform the redirect.
Don't use an <a> tag, but a <span> instead. (otherwise you must write code to preven the default action of the <a> tag, which is avoidable)


Thanks.
I saw the same format for the animation function, but was lazy enough to not notice this was in the JQuery UI. Thank you for pointing me in the right direction, I believe I can figure everything from this point :biggrin: .




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download