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 8289151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:26:35+00:00 2026-06-08T12:26:35+00:00

I am trying to create a content div with button links on a right

  • 0

I am trying to create a content div with button links on a right sidebar. When the user is not hovering over any of the buttons, the content should rotate through each of the five button topics (I’ve accomplished this). Also, when the user hovers over a specific button, what should happen is a) stop the rotation and b) display only the content topic related to that button.

Currently all I can make it do is rotate through the topics (with a Javascript function) and make content appear and disappear on hover (in HTML). Help please?

<script>
function rotatecontent(){
curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0
prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1
futcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex+1
messages[prevcontentindex].style.display="none"
messages[curcontentindex].style.display="block"
messages[futcontentindex].style.display="none"
}


window.onload=function(){
if (document.all || document.getElementById){
getElementByClass("dyncontent")
setInterval("rotatecontent()", 1000)
}
}

$('#container li').hover(function() {
    clearInterval(interval);
}, function() {
    interval = setInterval("rotatecontent()", 1000);
});

</script>

HTML:

 <body>


 <ul id="container">

 <li><a href="#">
 <img src="image1.jpg" width="250" height="100" class="Bab-
 image"></a></li>


 <li><a href="#"><img src="image2.jpg" class="sluotr-image 
 </a></li>

 <li><a href="#"><img src="image3.jpg" 
 class="blogs-image"></a></li>

 <li><a href="#"><img src="image4.jpg" class="chat-
 image"></a></li>

 <li><a href="#"><img src="image5.jpg" 
 class="view-image"></a>
 </li>

 </ul>

 <div class="dyncontent">
 <div id="div1">Content 1</div>
 <div id="div2" style="display:none">Content 2</div>
 <div id="div3" style="display:none">Content 3</div>
 <div id="div4" style="display:none">Content 4</div>
 <div id="div5" style="display:none">Content 5</div>
 </div>
 </body>
 </html>
  • 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-06-08T12:26:37+00:00Added an answer on June 8, 2026 at 12:26 pm

    Here’s a jsfiddle rotates until you hover over one of the hyperlinks, then resumes when you leave: http://jsfiddle.net/58pms/11/ (updated jsfiddle, original only went through one rotation)

    I feel like it’s hard to say what’s wrong with your original code since I had to add some variable declarations and HTML that were missing from your sample. I also took out the event handlers that would show the item you were hovering over for simplicity since I don’t think that was your main question.

    The HTML:

    <ul id="container" overflow:hidden>
        <li><a href="#">One</a></li>
        <li><a href="#">Two</a></li>
        <li><a href="#">Three</a></li>
        <li><a href="#">Four</a></li>
        <li><a href="#">Five</a></li>
    </ul>
    <div class="dyncontent">
    <div id="div1">Be A Billiken</div>
    <div id="div2" style="display:none">Be A Billiken 2</div>
    <div id="div3" style="display:none">Be A Billiken 3</div>
    <div id="div4" style="display:none">Be A Billiken 4</div>
    <div id="div5" style="display:none">Be A Billiken 5</div>
    </div>
    

    And the script:

    var messages;
    var curcontentindex = 0;
    var prevcontentindex;
    var futcontentindex;
    var i;
    
    function rotatecontent() {
        messages.hide();
        curcontentindex = (curcontentindex < messages.length - 1) ? curcontentindex + 1 : 0;
        messages.get(curcontentindex).style.display = "block";
    }
    
    
    $(function() {
        messages = $('.dyncontent').find('div');
        i = setInterval(rotatecontent, 1000);
    
    
        $('#container li').hover(function() {
            clearInterval(i);
        }, function() {
            i = setInterval(rotatecontent, 1000);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a grid like system with div's with content floated
I am trying to create a status window which content(textbox) should change in a
I am trying to create a flip button that shows changing content on every
I'm trying to create a button to show / hide a div below it,
I'm just trying to create a tab buttons by putting some hyper links inside
I am currently trying to create a content uploading system and although there are
I am trying to create and automatic preview mechanism for some content entered with
I'm trying to create an ascx control that can wrap content like a panel.
I'm trying to create an element in an XML where the basic content is
I am currently trying to create a site that filter the content based on

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.