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

The Archive Base Latest Questions

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

I am using a jquery banner to show advertisements on my site. When I

  • 0

I am using a jquery banner to show advertisements on my site. When I include one of these banners, it works well, however when I include a second only the first one works, the other just shows as a static image. Does anyone know why this happens?

Find below the html code with the JQuery banner:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple JavaScript Rotating Banner Using jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="jqbanner/js/jqbanner1.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen" href="jqbanner/css/jqbanner1.css" />
</head>

<body>
<div class="sec sec3 ">
<right>
<div id="jqb_object">

    <div class="jqb_slides">

        <div class="jqb_slide" title=" "><a href="http://www.entebbejunior.ac.ug/"><img src="jqbanner/images/ads/entebeJuniorSchool.png" alt=" Entebbe Junior School Logo"/></a></div>

    <div class="jqb_slide" title="" ><span> <br> <br> <br> <a href="http://www.entebbejunior.ac.ug/">Achievers in the making </a></span>...</div>
    </div>

    <div class="jqb_bar2"> 
        <div class="jqb_info"></div>    
        <div id="btn_next" class="jqb_btn jqb_btn_next"></div>
        <div id="btn_pauseplay" class="jqb_btn jqb_btn_pause"></div>
        <div id="btn_prev" class="jqb_btn jqb_btn_prev"></div>
    </div>

</div>

</right>
</div>
</body>
</html>

Attached find the code to the jquery file (jqbanner1.js):

// Simple JavaScript Rotating Banner Using jQuery
// www.mclelun.com
var jqb_vCurrent = 0;
var jqb_vTotal = 0;
var jqb_vDuration = 5000;
var jqb_intInterval = 0;
var jqb_vGo = 1;
var jqb_vIsPause = false;
var jqb_tmp = 20;
var jqb_title;
var jqb_imgW = 460;
var jqb_imgH = 250;

jQuery(document).ready(function() { 
    jqb_vTotal = $(".jqb_slides").children().size() -1;
    $(".jqb_info").text($(".jqb_slide").attr("title")); 
    jqb_intInterval = setInterval(jqb_fnLoop, jqb_vDuration);

    //Horizontal
    $("#jqb_object").find(".jqb_slide").each(function(i) { 
        jqb_tmp = ((i - 1)*jqb_imgW) - ((jqb_vCurrent -1)*jqb_imgW);
        $(this).animate({"left": jqb_tmp+"px"}, 500);
    });

    /*
    //Vertical
    $("#jqb_object").find(".jqb_slide").each(function(i) { 
        jqb_tmp = ((i - 1)*jqb_imgH) - ((jqb_vCurrent -1)*jqb_imgH);
        $(this).animate({"top": jqb_tmp+"px"}, 500);
    });
    */

    $("#btn_pauseplay").click(function() {
        if(jqb_vIsPause){
            jqb_fnChange();
            jqb_vIsPause = false;
            $("#btn_pauseplay").removeClass("jqb_btn_play");
            $("#btn_pauseplay").addClass("jqb_btn_pause");
        } else {
            clearInterval(jqb_intInterval);
            jqb_vIsPause = true;
            $("#btn_pauseplay").removeClass("jqb_btn_pause");
            $("#btn_pauseplay").addClass("jqb_btn_play");
        }
    });
    $("#btn_prev").click(function() {
        jqb_vGo = -1;
        jqb_fnChange();
    });

    $("#btn_next").click(function() {
        jqb_vGo = 1;
        jqb_fnChange();
    });
});

function jqb_fnChange(){
    clearInterval(jqb_intInterval);
    jqb_intInterval = setInterval(jqb_fnLoop, jqb_vDuration);
    jqb_fnLoop();
}

function jqb_fnLoop(){
    if(jqb_vGo == 1){
        jqb_vCurrent == jqb_vTotal ? jqb_vCurrent = 0 : jqb_vCurrent++;
    } else {
        jqb_vCurrent == 0 ? jqb_vCurrent = jqb_vTotal : jqb_vCurrent--;
    }


    $("#jqb_object").find(".jqb_slide").each(function(i) { 
        if(i == jqb_vCurrent){
            jqb_title = $(this).attr("title");
            $(".jqb_info").animate({ opacity: 'hide', "left": "-50px"}, 250,function(){
                $(".jqb_info").text(jqb_title).animate({ opacity: 'show', "left": "0px"}, 500);
            });
        } 


        //Horizontal Scrolling
        jqb_tmp = ((i - 1)*jqb_imgW) - ((jqb_vCurrent -1)*jqb_imgW);
        $(this).animate({"left": jqb_tmp+"px"}, 500);


        /*
        //Vertical Scrolling
        jqb_tmp = ((i - 1)*jqb_imgH) - ((jqb_vCurrent -1)*jqb_imgH);
        $(this).animate({"top": jqb_tmp+"px"}, 500);
        */

        /*
        //Fade In & Fade Out
        if(i == jqb_vCurrent){
            $(".jqb_info").text($(this).attr("title"));
            $(this).animate({ opacity: 'show', height: 'show' }, 500);
        } else {
            $(this).animate({ opacity: 'hide', height: 'hide' }, 500);
        }
        */

    });


}

Find attached the php file with the embedded html file:
Focus on :<div class="col4"> <?php include("jqbanner/EntebbeJuniorAd.html");?> </br> </br> <?php include("jqbanner/EntebbeJuniorAd.html");?> </div>

<?php
include("config/functions.inc.php");
include("config/function.php");
$detail=Get_Contents(16);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo ms_stripslashes($detail['meta_title'])?></title>
<meta name="description" content="<?php echo ms_stripslashes($detail['page_keyword'])?>" />
<meta name="keywords" content="<?php echo ms_stripslashes($detail['page_metadesc'])?>" />
<!-- Stylesheets -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<link rel="stylesheet" type="text/css" href="css/contentslider.css" />
<link href="css/jquery.fancybox-1.3.1.css" rel="stylesheet" type="text/css" />
<!-- Javascript -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/featuredcontentglider.js"></script>
<script type="text/javascript" src="js/jquery.min14.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.1.js"></script>
<script type="text/javascript" src="js/jcarousellite_1.0.1.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<script type="text/javascript" src="js/contentslider.js"></script>
<script type="text/javascript" src="js/ddaccordion.js"></script>
<script type="text/javascript" src="js/acordin.js"></script>
<script type="text/javascript" src="js/paging.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-1.3.1.js"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon.js"></script>
<script type="text/javascript" src="js/Trebuchet_MS_400-Trebuchet_MS_700-Trebuchet_MS_italic_700-Trebuchet_MS_italic_400.font.js"></script>
</head>


<body>
<!-- Wrapper -->
<div id="wrapper_sec">
    <!-- Header -->
    <div id="masthead">
        <div class="inner">
            <?php include("include/logo.php");?>
            <div class="right_head">
                <?php include("include/search.php");?>
                    <!-- Navigation -->
                <?php include("include/nav_top.php");?>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    <!-- Bread Crumb -->
        <?php include("include/breadcrumb.php");?>

    <!-- Content -->
    <div id="content_sec">
        <div class="inner2">            
            <div class="col3">
                <h3 class="heading colr">About Jigsaw</h3>

                <div class="">
                    <p><?php echo ms_stripslashes($detail['page_desc'])?></p>
                    <br />
                </div>

                <div class="clear"></div>

            </div>
            <div class="col4"> <?php include("jqbanner/EntebbeJuniorAd.html");?> </br> </br> <?php include("jqbanner/EntebbeJuniorAd.html");?> </div>

            <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="content_botm">&nbsp;</div>
    </div>
    <div class="clear"></div>
    <!-- Footer -->
    <div id="footer">
        <div class="inner">
            <?php include("include/footer/left.php");?>
            <?php include("include/footer/share.php");?>            
            <?php include("include/footer/connect.php");?>
            <?php include("include/footer/resource.php");?>            
        </div>
    </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-05-29T09:17:29+00:00Added an answer on May 29, 2026 at 9:17 am

    since you are initialising your banners via IDs $(“#jqb_object”), it only matches your first banner, all others wont get initialised.

    To work around this, give a really UNIQUE Id to all the elements you currently address via id (e.g. attach a unique string with php). Or you could use classes, but that most likey breaks your pause/next/prev – buttons.

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

Sidebar

Related Questions

I'm using JQUERY animate to show a banner at the top of the page,
Using jQuery Ajax to fetch data from local server: it works well with IE8
I am using jquery for a navigation bar as well as a home banner
I am using this jQuery Carousel inside a wordpress theme to show several banner
Using jQuery, can you show me the syntax for playing a sound? I would
Using jQuery 1.2.x and jQuery UI 1.5.x, one was able to trigger dragging manually
I'm currently using jQuery.Cycle to cycle through a few child <div> tags. However, I
I'm using some images as banners on my site. They're full (960px) width and
I'm supposed to make a PC site readable on mobile devices. I'm using Jquery
http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding I am using easy slider for banner and I called below script to

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.