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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:23:12+00:00 2026-06-15T16:23:12+00:00

I am quite new to JQuery and I have a question about Dot Navigation…

  • 0

I am quite new to JQuery and I have a question about Dot Navigation…

I have some Hero content which I have put together (using posts from here and JQuery site). Basically I have 3 div containers which are hidden and shown in a cycle. I also have three other div containers which have dots in them which I want to use as navigation. During the cycle the dots change colour to represent the “slide” the page is currently on.

What I want to do now is add a click event to each dot so the cycle jumps to and displays the corresponding content.

My Java Script is below.

        $('.heroContBG').each(function() {
        $(this).hide(0);
    });
    $('.heroContBG').first().show(0);
    $('.heroDots').last().removeClass('heroNavOff').addClass('heroNavOn');
    var delay = 6000; //Set delay time
    var divIdx = 0; //Set divIdx value
    var arrDiv = $('.heroContBG').toArray(); //Assign all heroContBG divs to array
    var arrDot = $('.heroDots').toArray(); //Assign all heroDots divs to array
    arrDot = arrDot.reverse(); //Reserve array index for Dot Navigation  

    function heroBG(){
        var $out = $(arrDiv[divIdx]); //Set $out variable to current array index (set by divIdx)
        var $dotOut = $(arrDot[divIdx]); //Set dotOut variable to current array index (set by divIdx)
        divIdx = (divIdx + 1) % arrDiv.length; //Convert array index 0-2 into 1-3
        var $in = $(arrDiv[divIdx]); //Set $in to $arrDix[divIdx]
        var $dotIn = $(arrDot[divIdx]); //Set $dotIn to $arrDot[divIdx]
        $out.fadeOut(600).hide(); //Hide element
        $dotOut.removeClass('heroNavOn').addClass('heroNavOff'); //Swap classes on .heroDots
        $in.fadeIn(1600).show(); //Show next element
        $dotIn.removeClass('heroNavOff').addClass('heroNavOn'); //Swap classes on .heroDots
    }
    setInterval(heroBG, delay); //Tell browser to loop through elements.

I think what I need to do is have a click event set the divIdx value to match that of the corresponding div container but as yet I have had no luck.

I will keep playing around with this and if I have success I will post it here. If anyone else knows how to do this that would be great.

I should also mention I don’t really want to use a 3rd party plugin as I am quite keen to improve my JQuery skills.

Cheers,

Simon

  • 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-15T16:23:13+00:00Added an answer on June 15, 2026 at 4:23 pm

    Simply use $(‘.heroDots’).index(myClickedHeroDot) to get the position of the targeted sibling. Then assign the returned index value to divIdx.

    Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question is quite basic but I am new to JQuery and
I'm quite new to JS and jQuery. I have a problem accessing the properties
I'm quite new to JQuery but I managed to do some things on my
Hy I'm quite new to jQuery and I can't solve this problem: I have
quite new to JQuery and Ive run into a problem. I have a form
I am quite new to jQuery, so my apologizes if there's something obvious I
I'm quite new to jQuery, and I've written a simple function to check the
Ok, so I'm quite new to jQuery, but found this bizzare problem just now,
I am still quite new to jQuery and I am trying to setup the
[I am quite new to jQuery so don't blame me if I get something

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.