Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Cycle - building a custom pager
    primarykey
    data
    text
    <p>A relatively (I hope) simple jQuery question:</p> <p>I have a menu:</p> <pre><code>&lt;ul id="menu" style="list-style:none"&gt; &lt;li&gt;&lt;a href="#asics"&gt;ASICS&lt;/a&gt;&lt;/li&gt; &lt;li&gt;/&lt;/li&gt; &lt;li&gt;&lt;a href="#plants"&gt;PLANTS PLUS&lt;/a&gt;&lt;/li&gt; &lt;li&gt;/&lt;/li&gt; &lt;li&gt;&lt;a href="#tooheys"&gt;TOOHEYS&lt;/a&gt;&lt;/li&gt; &lt;li&gt;/&lt;/li&gt; &lt;li&gt;&lt;a href="#olympics"&gt;OLYMPICS&lt;/a&gt;&lt;/li&gt; &lt;li&gt;/&lt;/li&gt; &lt;li&gt;&lt;a href="#panadol"&gt;PANADOL&lt;/a&gt;&lt;/li&gt; &lt;li&gt;/&lt;/li&gt; &lt;li&gt;&lt;a href="#kia"&gt;KIA CADENZA&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The menu is controlling a slider (code not necessary, just standard cycle divs. Here is the code, taken from the <a href="http://jquery.malsup.com/cycle/pager3.html" rel="nofollow">jQuery Cycle Plugin Pager Tutorial</a>:</p> <pre><code>var slider = new Swipe(document.getElementById('slider')); $('#adSlideshow').cycle({ fx: 'fade', speed: 'fast', timeout: 0, pager: '#menu', pagerAnchorBuilder: function(idx, slide) { // return selector string for existing anchor return '#menu li:eq(' + idx + ') a'; } }); </code></pre> <p>As you can see, in my menu every second link (the ones with the tags) is relevant for the pager; every <code>&lt;li&gt;/&lt;/li&gt;</code> item is just a spacer between each link item. How can I edit the pager code so that it only uses the correct <code>&lt;li&gt;</code> items?</p> <p>Here's a jsFiddle of it to better illustrate what I mean: <a href="http://jsfiddle.net/y4Qfw/12/" rel="nofollow">http://jsfiddle.net/y4Qfw/12/</a> &lt;-- As you can see, the links are calling every 2nd div. At the moment I'm just putting dummy divs in every second position so that the code works fine, but I'd rather find a less bulky solution. Thoughts?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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