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

  • Home
  • SEARCH
  • 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 8911937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:04:31+00:00 2026-06-15T04:04:31+00:00

I have created a slider in jQuery, CSS and HTML. It uses arrows and

  • 0

I have created a slider in jQuery, CSS and HTML.

It uses arrows and bullets to navigate as well as an autoplay system.

The problem I am having is: I would like the slider to change the slide that is displayed when the user clicks the respective bullet (i.e. bullet 1 slide 1 etc.) However when the user clicks the bullets, nothing happens.

I have tried using alerts to identify where the code is failing but it seems that the $('.bullet').click(function(){}) is not even called when clicking <span class="bullet">.

The error seems to occur because the bullets are auto generated. I don’t understand why.

Here’s a fiddle for everyone: http://jsfiddle.net/TczNn/7/

This is the code:

<!-- BEGIN CONTENT -->
        <div id="content">

            <!-- BEGIN CONTENT TOP SLIDESHOW -->
            <div id="top-slide">
                <div class="wrapper">

                <!-- BEGIN CONTENT TOP SLIDESHOW SLIDES -->
                    <div id="slide0" class="slide">
                        <h2>Your Site... Defined</h2>
                        <h4>With D&amp;D there is no inbetween, we will never compromise your requirements.</h4>
                    </div>  

                    <div id="slide1" class="slide">
                        <h2>Your Site... Defined 2</h2>
                        <h4>With D&amp;D there is no inbetween, we will never compromise your requirements.</h4>
                    </div>                     

                    <div id="slide2" class="slide">
                        <h2>Your Site... Defined 3</h2>
                        <h4>With D&amp;D there is no inbetween, we will never compromise your requirements.</h4>
                    </div>                     
                <!-- END CONTENT TOP SLIDESHOW SLIDES -->

                </div>

                <div id="numSlides">3</div>

                <div class="arrows">
                    <span class="arrow left"></span>
                    <span class="arrow right"></span>
                </div>
                <div id="select">
                    <div class="wrapper">
                        <div class="bullets">
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>          
            </div>
            <!-- END CONTENT TOP SLIDESHOW -->
    </div>

CSS:

/*====================================================
    D&D Creative Solutions
    ----------------------------------------------
        Explore D&D Creative - v1.0
        Date: 30/11/2012
        Stylesheet By: David Passmore
        StandAlone
    ----------------------------------------------
© D&D Creative Solutions - All Rights Reserved
====================================================*/

/*============================================
    ENABLE FONTS
============================================*/

@import url(http://fonts.googleapis.com/css?family=PT+Sans:400,700);

body {
    font-family:"PT Sans";
    font-size:13px;
}

/*============================================
    LINKS
============================================*/
a {
    text-decoration:none;
    color:#CCCCCC;
    -moz-transition: color 150ms ease-out;
    -webkit-transition: color 150ms ease-out;
}

/*============================================
    LAYOUT
============================================*/
html, body {
    width:100%;
    height:100%;
    margin:0;
    padding:0;
}

.wrapper {
    width:1000px;
    margin:0 auto;
}

#header .wrapper, #footer .wrapper {
    width:1100px;
}

.clear {
    clear:both !important;
    float:none !important;
}

/*============================================
    HEADER
============================================*/
#header {
    position:fixed;
    height:55px;
    line-height:55px;
    background-color:#3D3B37;
    color:#FFFFFF;
    width:100%;
    top:0;
    z-index:9999;
}

#header .wrapper ul {
    list-style:none;
    margin:0;
    padding:0;
}

#header .wrapper ul > li {
    float:left;
    margin:0 8px;
}

#header .wrapper div.main-nav {
    float:right;
    text-transform:uppercase;
    font-size:12px;
}

#header .wrapper div.top-logo {
    float:left;
    text-transform:uppercase;
    font-size:16px;
    width:126px;
    height:55px;
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/common/header/logo-new.png) center no-repeat;
}

/*
#header .wrapper div.main-nav ul li.separator {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/common/header/header-nav-sep.png) center no-repeat;
    width: 5px;
    height: 55px;
}
*/

#header .wrapper div.main-nav ul li.separator {
    line-height:53px;
}

#header .wrapper div.main-nav ul li {
    color:#CCCCCC;
}

#header .wrapper div.main-nav ul li a:hover {
    color:#FFFFFF;
}

#header .wrapper div.main-nav ul li.active {
    color:#FFFFFF;
}

/*============================================
    CONTENT
============================================*/
#content {
    min-height:100%;
    margin-top:55px;
    padding-top:10px;
}

/*============================================
    FOOTER
============================================*/
#footer {
    background-color:#3D3B37;
    color:#CCCCCC;
    height:30px;
    line-height:30px;
    font-size:10px;
    text-transform:uppercase;
}

#footer .wrapper > div {
    float:left;
    margin-left:50px;
}

#footer .wrapper div.links ul li a:hover {
    color:#FFFFFF;
}

#footer .wrapper div.social {
    float:right;
    margin-left:0;
}

#footer .wrapper div > ul {
    list-style:none;
    margin:0;
    padding:0;
}

#footer .wrapper div ul > li {
    float:left;
    margin:0 8px;
}

#footer .wrapper div.links ul li.separator {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/common/footer/footer-nav-sep.png) top no-repeat;
    width: 5px;
    height: 17px;
    margin-top: 5px;
}

/*============================================
    HOME.PHP
============================================*/
#home #content #top-slide {
    background-color:#3D3B37;
    height:300px;
    position:relative;
    color:#FFFFFF;
}

#home #content #top-slide .slide {
    position:absolute;
    opacity: 0;
    left:-1000px;
}

#home #content #top-slide .wrapper {
    position:relative;
}

#home #content #top-slide #numSlides{
    visibility: hidden;
}

#home #content #top-slide h2, #home #content #top-slide h4 {
    position:absolute;
    margin:0;
}

#home #content #top-slide h2 {
    margin:60px 0 0 0;
    font-size:36px;
    text-shadow: 0 1px 1px #1F1E1C;
}

#home #content #top-slide h4 {
    margin:150px 0 0 0;
    text-shadow: 0 1px 1px #1F1E1C;
}

#home #content #top-slide .arrows {
    width:1100px;
    margin:0 auto;
    height:300px;
    position:absolute;
    top:0;
    left:0;
    right:0;
}

#home #content #top-slide .arrows span.arrow {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/arrows.png) no-repeat;
    display:block;
    height:36px;
    width:25px;
    position:absolute;
    top:40%;
}

#home #content #top-slide .arrows span.arrow.left {
    background-position:left;
    left:0;
}

#home #content #top-slide .arrows span.arrow.right {
    background-position:right;
    right:0;
}

#home #content #top-slide #select {
    height:48px;
    width:100%;
    position:absolute;
    bottom:0;
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/bg-slie-select.png) repeat;
    display:none;
    line-height:48px;
}

#home #content #top-slide #select span.bullet {
    height:48px;
    width:25px;
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/bullets.png) no-repeat right;
    line-height:48px;
    display:block;
    float:left;
    cursor:pointer;
}

#home #content #top-slide #select span.bullet:hover {
    background-position:center;
}

#home #content #top-slide #select span.bullet.selected {
    background-position:left;
}

#home #content #twitter-main {
    background-color:#cccccc;
    height:200px;
    margin:10px 0;
    padding-top:30px;
    text-align:center;
}

#home #content #twitter-main i.icon-twitter {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/common/social/twitter.png) no-repeat center;
    width:37px;
    height:37px;
    margin:0px auto 20px auto;
    display:block;
}

#home #content #twitter-main span.divider {
    border-top:1px solid #535353;
    height:0;
    width:100px;
    display:block;
    margin:0 auto;
}

#home #content #twitter-main h2.feed {
    margin:40px 0;
}

#home #content #twitter-main p.info {
    font-size:10px;
    color:#666666;
}

#home #content #services {
    height:500px;
    margin:0 0 10px 0;
    background:#DDDDDD;
    padding-top:20px;
}

#home #content #services .wrapper > h2{
    margin-top:0px;
    font-size:24px;
}

#home #content #services .cols .col {
    margin:0 50px;
    float:left;
    width:233px;
    text-align:center;
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/services-c-c.png) no-repeat top;
    height:260px;
    padding-top:170px;
}

#home #content #services .cols #ac.col {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/services-c-ac.png) no-repeat top;
}

#home #content #services .cols #sup.col {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/services-c-support.png) no-repeat top;
}

#home #content #services .cols #qu.col {
    background:url(http://new.dpwebdev.co.uk/business-sites/explore-d-and-d/media/img/home/services-c-qu.png) no-repeat top;
}

#home #content #services .cols .col span.divider {
    border-top:1px solid #3D3B37;
    height:0;
    width:100px;
    display:block;
    margin:0 auto;
}
/*============================================
    STAFF.PHP
============================================*/
#staff #content #top-content {
    background-color:#3D3B37;
    height:300px;
    margin-top:-10px;
    position:relative;
    padding-top:20px;
    color:#FFFFFF;
    text-align:center;
}

#staff #content #top-content h1 {
    font-size:36px;
}

#staff #content #top-content span.divider {
    border-top:2px solid #FFFFFF;
    height:0;
    width:400px;
    display:block;
    margin:0 auto;
}

/*============================================
    STAFF.PHP
============================================*/

#contact #content #top-content {
    background-color:#3D3B37;
    height:300px;
    margin-top:-10px;
    position:relative;
    padding-top:20px;
    color:#FFFFFF;
    text-align:center;
}

#contact #content #top-content h1 {
    font-size:36px;
}

#contact #content #top-content span.divider {
    border-top:2px solid #FFFFFF;
    height:0;
    width:400px;
    display:block;
    margin:0 auto;
}

​
JS :

$(document).ready(function() {


    //HOME.PHP
    $('#home #top-slide').bind("mouseenter", function(){
      $('#select').stop(true).fadeIn(600);
    });

    $('#home #top-slide').bind("mouseleave", function(){
      $('#select').stop(true).fadeOut(600);
    });




    //HOME.PHP - SLIDER

    function mainSlider() {
        var numsliders;
        var currentSlider = 0;
        var interval;
        var slideWidth;

        $('#slider0').css('opacity', 1);
        $(document).ready(function() {
            numsliders = parseInt($('#numSlides').html());
            generateBullets();
            $('#slide0').css('left', '0px');
            $('#slide0').css('height', '300px');
            $('#slide0').css('width', '1000px');
            $('#slide0').css('top', '0px');
            $('#slide0').css('opacity', '1');
            $('#slide0').addClass("showing");
            slideWidth = $('#slide0').width();
        });

        function nextSlider() {
            specificSlider((currentSlider + 1) % numsliders);
        }

        interval = window.setInterval(nextSlider, 7000);

        //arrow, bullet and autoplay functions




        function previousSlider() {
            if (currentSlider !== 0) {
                specificSlider((currentSlider - 1));
            }
        }

        function generateBullets() {
            var $bullet = $('#select .bullets');

            for (var i = 0; i < numsliders; i++) {
                $bullet.append('<span class="bullet" id="' + i + '"></span>');
            }

            $('.bullets #0').addClass("selected");
        }

        //call arrow functions
        $('span.arrow.left').click(function() {
            previousSlider();
        });

        $('span.arrow.right').click(function() {
            nextSlider();
        });

        //call bullet functions
        $('.bullet').click(function() {

            var $id = $(this).attr("id");

            specificSlider($id);
        });


        function specificSlider(sliderNumber) {
            window.clearInterval(interval);

            // move the next slider on deck
            $('#slider' + sliderNumber).css('left', $('#top-slide').css('width'));
            $('#slider' + sliderNumber).css('top', '0px');
            $('#slider' + sliderNumber).css('height', '300px');
            $('#slider' + sliderNumber).css('width', '1000px');

            // move old slide off, 
            $('#slide' + currentSlider).animate({
                left: '-1020px',
                top: '0px',
                height: '300px',
                width: '1000px',
                opacity: 0
            }, 900, null);
            $('#slide' + currentSlider).removeClass("showing");
            $('.bullets #' + currentSlider).removeClass("selected");

            // new slide on
            $('#slide' + sliderNumber).animate({
                left: '0px',
                height: '300px',
                width: '1000px',
                top: '0px',
                opacity: 1
            }, 900, null);
            $('#slide' + sliderNumber).addClass("showing");
            $('.bullets #' + sliderNumber).addClass("selected");

            currentSlider = sliderNumber;

            interval = window.setInterval(nextSlider, 7000);
        }
    }

    //initalise slider 
    mainSlider();

});​
  • 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-15T04:04:33+00:00Added an answer on June 15, 2026 at 4:04 am

    You are creating the span with bullet class dynamically .. So the normal click event will not work.. You need to delegate the event to a static parent..

    $('.bullet').click(function() {
    

    supposed to be

    $('body').on('click','.bullet' ,function() {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with some jquery animations. I have dynamically created divs with
I have created jquery image slider and it is working good. However i have
I have a page which contains a jQuery-UI horizontal slider, created using a little
I have created a jquery slider. On clicking next or back buttons .animate function
I have created a very simple jQuery content slider. I want to turn this
I have created some JQuery that will expand a div 'popup' on hover and
I have created a menu using CSS and Javascript. When I click on a
I have currently implemented this image slider http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html on a site but for some
I'm trying to create a slider in JQuery. I have two images on top
I have a problem with my web site position, this is my CSS: My

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.