/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Jquery callback

I’m been looking at Jquery call backs but i just don’t understand how to execute what i need. I want to call a js function as a callback (when the animation completes) but i’m unsure of the syntax.

My current code is:

[CODE] $j(document).ready(function(){
$j(“#find”).click(function () {
$j(“#localfinder”).css(‘background-image’, ‘url(/img/other/localfinderlong.gif)’);
$j(“#localfinder”).animate({ height: 187 }, 500);
});
});
[/CODE]

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottMar 11.2009 — $j("#localfinder").animate({ height: 187 }, 500[color=red], function(){ alert("Animation done") }[/color]);
Copy linkTweet thisAlerts:
@cfgcjmauthorMar 11.2009 — what about an external js function? is that possible
Copy linkTweet thisAlerts:
@Jeff_MottMar 11.2009 — What do you mean by an "external function"? Either a JS function has been included in the page or it hasn't. If it hasn't, then you need to do that first.
Copy linkTweet thisAlerts:
@cfgcjmauthorMar 11.2009 — I mean if you have an element you can make it run the script like so:

onclick="JSfunction();"

and it references a function in an external .js file

i don't want to include the function code in my jquery code
Copy linkTweet thisAlerts:
@Jeff_MottMar 11.2009 — I understand what you mean now. You would do this.
$j("#localfinder").animate({ height: 187 }, 500, [color=red]JSfunction[/color]);
Copy linkTweet thisAlerts:
@cfgcjmauthorMar 11.2009 — Fantastic...thanks!
×

Success!

Help @cfgcjm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...