Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I modify slider code counter?
    primarykey
    data
    text
    <p>I have a content slider, and the counter for the content slider updates based on using cnt.text(i+1+' / '+amount); But instead of it displaying a numerical counter, I would like for it to show bullets instead, with an active class being assigned.</p> <p>Here is a jsfiddle of the below: <a href="http://jsfiddle.net/REn8C/2/" rel="nofollow">http://jsfiddle.net/REn8C/2/</a></p> <p>HTML for the slider is:</p> <pre><code>&lt;div class="homepageslider_imageholder"&gt; &lt;ul id="sliderbannerlist" class="homepageslider_imageslist"&gt; &lt;li class="acslide slide1" style=""&gt; &lt;div class="acslidecontainer"&gt; SLIDE 1 HERE &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;li class="acslide slide2" style="display: none;"&gt; &lt;div class="acslidecontainer"&gt; SLIDE 2 HERE &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;li class="acslide slide3" style="display: none;"&gt; &lt;div class="acslidecontainer"&gt; SLIDE 3 HERE &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;li class="acslide slide4" style="display: none;"&gt; &lt;div class="acslidecontainer"&gt; SLIDE 4 HERE &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;!-- Slide Pager: Start --&gt; &lt;div id="slidecounter" class="homepageslider_pagerholder"&gt; &lt;ul class="homepageslider_pagerlist"&gt; &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="active"&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!-- Slide Pager: End --&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is the CSS:</p> <pre><code>div.homepageslider {} div.homepageslider_holder {} div.homepageslider_inner { position: relative; margin: 0 auto; width: 929px; height: 318px; border: 9px solid #fff; background: #d7c288; -webkit-box-shadow: 0 0 25px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 25px rgba(0, 0, 0, 0.15); box-shadow: 0 0 25px rgba(0, 0, 0, 0.15); } /* Navigation */ div.homepageslider_nav { position: absolute; top: 35px; right: 0; z-index: 50; width: 155px; } ul.homepageslider_navlist { margin: 0; padding: 0; list-style-type: none; } ul.homepageslider_navlist li { margin: 0 0 3px !important; display: block; width: 155px; height: 25px; font-size: 12px; letter-spacing: -0.75px; line-height: auto; list-style-type: none; } ul.homepageslider_navlist a { padding: 0 0 0 12px; display: block; height: 25px; color: #fff; text-decoration: none !important; text-transform: uppercase; background-color: #736056; text-shadow: 1px 1px 0 #40352f; -webkit-transition: all 0.3s ease-in-out; -moz-transition: all 0.3s ease-in-out; -ms-transition: all 0.3s ease-in-out; -o-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; } ul.homepageslider_navlist a:hover { background-color: #40352f; } ul.homepageslider_navlist span { display: block; height: 25px; line-height: 25px; } /* Image Holder */ div.homepageslider_imageholder { position: relative; z-index: 40; margin: 0; padding: 0; width: 929px; height: 318px; } ul#sliderbannerlist { margin: 0; padding: 0; list-style-type: none; } ul#sliderbannerlist li.acslide { position: absolute; top: 0; left: 0; z-index: 5; width: 929px; height: 318px; list-style-type: none; } ul#sliderbannerlist div.acslidecontainer { width: 929px; height: 318px; } ul#sliderbannerlist img {} /* Pager Holder */ div.homepageslider_pagerholder { position: absolute; bottom: 0; left: 50%; z-index: 50; margin: 0 0 0 -40px; padding: 0 9px; height: 22px; background-color: #fff; } ul.homepageslider_pagerlist { margin: 0; padding: 0; list-style-type: none; } ul.homepageslider_pagerlist li { margin: 7px 5px 0; padding: 0; display: block; float: left; width: 8px; height: 8px; list-style-type: none; } ul.homepageslider_pagerlist li.active {} ul.homepageslider_pagerlist span { display: block; width: 8px; height: 8px; cursor: pointer; background-color: #89c2b2; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } ul.homepageslider_pagerlist li.active span { background-color: #595656; } </code></pre> <p>The plugin for the slider is:</p> <pre><code>(function($){ $.fn.acSlider = function(interval) { var slides; var cnt; var amount; var i; function run() { // Hiding previous slide and showing next $(slides[i]).fadeOut(1000); i++; if (i &gt;= amount) i = 0; $(slides[i]).fadeIn(1000); // Updating Counter cnt.text(i+1+' / '+amount); // Loop setTimeout(run, interval); } slides = $('#sliderbannerlist').children(); cnt = $('#slidecounter'); amount = slides.length; i=0; // Updating Counter cnt.text(i+1+' / '+amount); setTimeout(run, interval); }; })(jQuery); </code></pre> <p>Right now, since there are 4 slides, what will be added for the counter inside #slidecounter is 1/4, 2/4, 3/4, 4/4. Instead, I would like to use what I have in my HTML for the counter, with the class changing to the active bullet:</p> <pre><code> &lt;!-- Slide Pager: Start --&gt; &lt;div id="slidecounter" class="homepageslider_pagerholder"&gt; &lt;ul class="homepageslider_pagerlist"&gt; &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="active"&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!-- Slide Pager: End --&gt; </code></pre> <p>How do I modify the jQuery plugin so that the counter is modified to work the way I want it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload