Adding pauses to a function
Hi:
the following function shows the text associated with each of two instances of a class--hover on either 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');
});
}
Both texts pop in simultaneoulsy.
I've been trying to slow it down, so that there's a pause before the first test appears (say, 400ms); then maybe another pause before the second text appears.
For a start, I tried wrapping the whole function in a setTimeout, as a way of getting the initial pause. The result: no pause, but the original function within the setTimeout works. The texts pop in. (I've also tried using a 2000ms pause, to make sure I wasn't missing what was going on).
What am I missing?
Cheers