www.webdeveloper.com
Results 1 to 2 of 2

Thread: adding pauses to a function

  1. #1
    Join Date
    Sep 2017
    Location
    australia
    Posts
    5

    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');
    	});
    }
    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?

  2. #2
    Join Date
    Dec 2012
    Posts
    1,609
    I'm not shure if I understand you correctly. You write:
    the text associated with each of two instances of a class
    and
    both texts
    Does this mean that (e. g.)
    Code:
    $(this).find('.mytext')
    matches two texts?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"