/    Sign up×
Community /Pin to ProfileBookmark

adding pauses to a function

Hi:

the following function shows the text associated with each of two instances of a class–hover on one instance of ‘myclass’ and you’ll get the text associated with it, and the text associated with its neighbour:

[CODE]function showBoth() {
$(‘.myclass’).hover(function(){
$(this).find(‘.mytext’).visibility(‘visible’);
});
$(‘.pair1’).hover(function(){
$(this).next().find(‘.mytext’).visibility(‘visible’);
});
$(‘.pair2’).hover(function(){
$(this).prev().find(‘.mytext’).visibility(‘visible’);
});
}[/CODE]

This shows both texts instantly and simultaneouly.

I’ve been trying to slow it down, so that there’s a pause before the first test appears (say, 400ms), then another pause before the second text appears. But I’ve had no success so far with setTimeouts–including wrapping the whole function in a setTimeout as a way of getting the initial pause.

Any ideas?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumJan 03.2018 — I'm not shure if I understand you correctly. You write:the text associated with each of two instances of a class[/QUOTE]andboth texts[/QUOTE]Does this mean that (e. g.)
$(this).find('.mytext')matches two texts?
×

Success!

Help @Oddjob41 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.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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