Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:20:17+00:00 2026-05-29T17:20:17+00:00

Here is my code for a mouseover: $(‘.caption’).mouseover(function() { $(this).fadeTo(‘slow’,1); $(this).css(‘color’,’#ddd’).animate({‘color’: ‘white’}, 500); $(this).css(‘font-weight’,’bold’);

  • 0

Here is my code for a mouseover:

$('.caption').mouseover(function() {
    $(this).fadeTo('slow',1);
    $(this).css('color','#ddd').animate({'color': 'white'}, 500); 
    $(this).css('font-weight','bold');
});

$('.caption').mouseleave(function() {
    $(this).fadeTo('slow',0.9);
    $(this).css('color','white').animate({'color': '#ddd'}, 500); 
    $(this).css('font-weight','normal');
});

I have four boxes that this works with, all with the class .caption. I would like to make these actions rotate between the four of them with a certain number of seconds pause (say, 5) before moving to the next one. In other words, the mousedown effects (without having a mousedown), wait 5 seconds, mouseup effect, then move to the 2nd .caption, and do the same… etc.

Here is where I am, 45 minutes later or so.

function doRotate(num) {

    var len = 3; // starts at 0
    var index = num;

    $('div .nav-piece').each = function() {
        setInterval(function() {
            $('div .nav-piece').eq(index).animate({
                backgroundColor: "white"
            }, 500);
        }, 500);

        setInterval(function() {
            $('div .nav-piece').eq(index).animate({
                backgroundColor: "#cfc4c3"
            }, 500);
        }, 500);
    }
}

Here is the html:

 <div id="nav-container">
        <div id="piece1" class="nav-piece">
            <div style="background-image: url('assets/bg_example.jpg'); background-repeat: no-repeat;">
                <div class="caption overlay-top">Text example</div>
            </div>
        </div>
          <div id="piece2" class="nav-piece">
            <div style="background-image: url('assets/bg_example.jpg'); background-repeat: no-repeat;">
                <div class="caption overlay-bottom">Text example</div>
            </div>
        </div>
          <div id="piece3" class="nav-piece">
            <div style="background-image: url('assets/bg_example.jpg'); background-repeat: no-repeat;">
                <div class="caption overlay-top">Text example</div>
            </div>
        </div>
          <div id="piece4" class="nav-piece">
            <div style="background-image: url('assets/bg_example.jpg'); background-repeat: no-repeat;">
                <div class="caption overlay-bottom">Text example</div>
            </div>
        </div>
    </div>

doReady is called at document.ready.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:20:18+00:00Added an answer on May 29, 2026 at 5:20 pm

    First of all, you should use mouseenter/mouseleave or mouseover/mouseout in combination, not a mix of the two behaviors

    This will achieve what you want. Each caption is executed in the callback from the prior animation. We use queue to put the element’s into the fx queue (the only place delay() works).

    I’d throw this on fiddle, but fiddle seems to be in read-only mode today! 🙂

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
       <title>test url stuff</title>
    
    
       <style type="text/css">
          .caption { width: 50px; height: 50px; margin: 20px; padding: 5px; float: left; }
          .red { background-color: red; }
          .blue { background-color: blue; }
          .yellow { background-color: yellow; }
          .green { background-color: green; }
          .black { background-color: black; }
       </style>
    
       <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
       <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js"></script>
    
    </head>
    <body>
    
    <script type="text/javascript">
       jQuery(function($) {
          var
             // how long should it animate?
             howLong = 1000,
    
             // apply the font-weight when animation completes
             mouseInProps = {duration: 500, complete: function() { $(this).css('font-weight','bold');} },
    
             mouseOutProps = {duration: 500,
                complete: function() {
                   var $this = $(this);
                   // apply the font-weight when animation completes
                   $this.css('font-weight','normal');
                   if( $this.next().length ) {
                      // this makes them successively call the next element and animate it
                      // by using the complete: callback on animate's props
                      queueOne($this.next());
                   }
                }
             };
    
          function queueOne($e) {
             $e.queue(function(){
                $(this).fadeTo('slow', 1).animate({'color': '#fff'}, mouseInProps).dequeue();
             })
             // make the queue pause x seconds
             .delay(howLong)
             // apply the mouseleave effects
             .queue(function() {
                $(this).fadeTo('slow', .9).animate({'color': '#ddd'}, mouseOutProps).dequeue();
             });
          }
    
          queueOne($('.caption').first());
       });
    </script>
    
    <div class="caption red">one</div>
    <div class="caption green">two</div>
    <div class="caption blue">three</div>
    <div class="caption yellow">four</div>
    <div class="caption black">five</div>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code: //Mouseover start countdown $(#icon_no_1).mouseover(function() { $(this).fadeTo(slow, 0.23); //Countdown var counter
Here's my code: function mouseOver(variable) { return function() { $(variable).fadeIn(100); }; } function mouseOut(variable)
Here's my code that does work: function mouseOver() { $(.beaver).fadeIn(100); } function mouseOut() {
Here is my code: $(document).ready(function(){ $('.classOne').mouseover(function(e) { alert($(e).attr('id')); }); }); Now, I know that
I've been having some problem with this code $(#click).bind('mousedown mouseup mouseover', function(e) { if(e.type
Ok the error is showing up somewhere in this here code if($error==false) { $query
See here: http://code.google.com/p/ie7-js/ Does anyone have any experience or remarks about this javascript? Is
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
I have this code here, which is intended to allow any type of arguments:
I have the code here: http://jsfiddle.net/vFJvL/ when you mouseover Submenu3 the product list dropsdown

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.