TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Michael Griffiths
655
1.5k
503k
how to make my slideshow responsive
May 8 2016 6:09 AM
<p>I hope you are all well on this fine day. I have made a slideshow but it is not responsive at this time, i.e. not shrinking down on smaller browser window.</p><p>It is because of my height and width declarations in the css but when I change them to percentages it stops my slideshow from working. Any hints or tips anyone can offer would be gratefully received.</p><p>My html:</p><pre class="default prettyprint prettyprinted"><code><span class="pln"> </span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"slideShow"</span><span class="tag">></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"slideShowWindow"</span><span class="tag">></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"slide"</span><span class="tag">></span><span class="pln"> </span><span class="tag"><img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"../Images/golden.jpg"</span><span class="tag">/></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"slideText"</span><span class="tag">></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"><h2></span><span class="pln">Golden pearl</span><span class="tag"></h2></span><span class="pln"> </span><span class="tag"><p></span><span class="pln">This golden pearl came from a farm in the south china sea</span><span class="tag"></p></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"></div></span><span class="pln"> </span><span class="com"><!-- </slideText> --></span><span class="pln"></span><span class="tag"></div></span><span class="pln"></span><span class="com"><!-- </slide> repeat as many times as needed --></span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"slide"</span><span class="tag">></span><span class="pln"></span><span class="tag"><img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"../Images/zen.jpg"</span><span class="tag">/></span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"slideText"</span><span class="tag">></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"><h2></span><span class="pln">Simply Zen</span><span class="tag"></h2></span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="tag"><p></span><span class="pln">What else is there to say?!</span><span class="tag"></p></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"></div></span><span class="pln"> </span><span class="com"><!-- </slideText> --></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="tag"></div></span><span class="pln"></span><span class="com"><!-- </slide> repeat as many times as needed --></span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"slide"</span><span class="tag">></span><span class="pln"></span><span class="tag"><img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"../Images/rain.jpg"</span><span class="tag">/></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"><div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"slideText"</span><span class="tag">></span><span class="pln"></span><span class="tag"><h2></span><span class="pln">Lariat In 'Rain'</span><span class="tag"></h2></span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="tag"><p></span><span class="pln">Lariat In 'Rain' motif using diamonds, white gold, Tahitian pearls, and silk.</span><span class="tag"></p></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="tag"></span><span class="pln"></span><span class="tag"></div></span><span class="pln"> </span><span class="com"><!-- </slideText> --></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="tag"></div></span><span class="pln"></span><span class="com"><!-- </slide> repeat as many times as needed --></span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="tag"></div></span><span class="pln"> </span><span class="com"><!-- </slideShowWindow> --></span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="tag"></div></span><span class="pln"> </span><span class="com"><!-- </slideshow> --></span></code></pre><p>My css:</p><pre class="default prettyprint prettyprinted"><code><span class="pln">img </span><span class="pun">{</span><span class="pln">display</span><span class="pun">:</span><span class="pln"> block</span><span class="pun">;</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pun">%;</span><span class="pln">height</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">auto</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"> p</span><span class="pun">{</span><span class="pln">background</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln">color</span><span class="pun">:#</span><span class="pln">ffffff</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"> </span><span class="com">#slideShow #slideShowWindow </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">650px</span><span class="pun">;</span><span class="pln">height</span><span class="pun">:</span><span class="pln"> </span><span class="lit">450px</span><span class="pun">;</span><span class="pln">margin</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">padding</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">position</span><span class="pun">:</span><span class="pln"> relative</span><span class="pun">;</span><span class="pln">overflow</span><span class="pun">:</span><span class="pln">hidden</span><span class="pun">;</span><span class="pln">margin</span><span class="pun">-</span><span class="pln">left</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">auto</span><span class="pun">;</span><span class="pln">margin</span><span class="pun">-</span><span class="pln">right</span><span class="pun">:</span><span class="kwd">auto</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="com">#slideShow #slideShowWindow .slide </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com">{</span><span class="pln">margin</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">padding</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">650px</span><span class="pun">;</span><span class="pln">height</span><span class="pun">:</span><span class="pln"> </span><span class="lit">450px</span><span class="pun">;</span><span class="pln"></span><span class="kwd">float</span><span class="pun">:</span><span class="pln"> left</span><span class="pun">;</span><span class="pln">position</span><span class="pun">:</span><span class="pln"> relative</span><span class="pun">;</span><span class="pln">margin</span><span class="pun">-</span><span class="pln">left</span><span class="pun">:</span><span class="kwd">auto</span><span class="pun">;</span><span class="pln">margin</span><span class="pun">-</span><span class="pln">right</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">auto</span><span class="pun">;</span><span class="pln"></span><span class="pun">}</span><span class="pln"></span><span class="com">#slideshow #slideshowWindow .slide{</span><span class="pln">position</span><span class="pun">:</span><span class="pln">absolute</span><span class="pun">;</span><span class="pln">bottom</span><span class="pun">:</span><span class="lit">18px</span><span class="pun">;</span><span class="pln">left</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln">width</span><span class="pun">:</span><span class="lit">100</span><span class="pun">%;</span><span class="pln">height</span><span class="pun">:</span><span class="kwd">auto</span><span class="pun">;</span><span class="pln">margin</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln">padding</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln">color</span><span class="pun">:#</span><span class="pln">ffffff</span><span class="pun">;</span><span class="pln">font</span><span class="pun">-</span><span class="pln">family</span><span class="pun">:</span><span class="typ">Myriad</span><span class="pln"> </span><span class="typ">Pro</span><span class="pun">,</span><span class="pln"> </span><span class="typ">Arial</span><span class="pun">,</span><span class="pln"> </span><span class="typ">Helvetica</span><span class="pun">,</span><span class="pln"> sans</span><span class="pun">-</span><span class="pln">serif</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="pun">.</span><span class="pln">slideText </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="pun">{</span><span class="pln">background</span><span class="pun">:</span><span class="pln"> rgba</span><span class="pun">(</span><span class="lit">128</span><span class="pun">,</span><span class="pln"> </span><span class="lit">128</span><span class="pun">,</span><span class="pln"> </span><span class="lit">128</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0.49</span><span class="pun">);</span><span class="pln">text</span><span class="pun">-</span><span class="pln">align</span><span class="pun">:</span><span class="pln">center</span><span class="pun">;</span><span class="pln">bottom</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln">padding</span><span class="pun">:</span><span class="lit">10px</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="com">#slideshow #slideshowWindow .slide .slideText h2, </span><span class="pln"> </span><span class="com">#slideshow #slideshowWindow .slide .slideText p </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com">{</span><span class="pln">margin</span><span class="pun">:</span><span class="lit">10px</span><span class="pun">;</span><span class="pln">padding</span><span class="pun">:</span><span class="lit">15px</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"></span><span class="pun">.</span><span class="pln">slideNav </span><span class="pun">{</span><span class="pln">display</span><span class="pun">:</span><span class="pln"> block</span><span class="pun">;</span><span class="pln">text</span><span class="pun">-</span><span class="pln">indent</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">10000px</span><span class="pun">;</span><span class="pln">position</span><span class="pun">:</span><span class="pln"> absolute</span><span class="pun">;</span><span class="pln">cursor</span><span class="pun">:</span><span class="pln"> pointer</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="com">#leftNav </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com">{</span><span class="pln">left</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">bottom</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">48px</span><span class="pun">;</span><span class="pln">height</span><span class="pun">:</span><span class="pln"> </span><span class="lit">48px</span><span class="pun">;</span><span class="pln">background</span><span class="pun">-</span><span class="pln">image</span><span class="pun">:</span><span class="pln"> url</span><span class="pun">(</span><span class="str">"../Images/plus_add_minus.png"</span><span class="pun">);</span><span class="pln">background</span><span class="pun">-</span><span class="pln">repeat</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">no</span><span class="pun">-</span><span class="pln">repeat</span><span class="pun">;</span><span class="pln">z</span><span class="pun">-</span><span class="pln">index</span><span class="pun">:</span><span class="pln"> </span><span class="lit">10</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"> </span><span class="com">#rightNav </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com">{</span><span class="pln">right</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">bottom</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">48px</span><span class="pun">;</span><span class="pln">height</span><span class="pun">:</span><span class="pln"> </span><span class="lit">48px</span><span class="pun">;</span><span class="pln">background</span><span class="pun">-</span><span class="pln">image</span><span class="pun">:</span><span class="pln"> url</span><span class="pun">(</span><span class="str">"../Images/plus_add_green.png"</span><span class="pun">);</span><span class="pln">background</span><span class="pun">-</span><span class="pln">repeat</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">no</span><span class="pun">-</span><span class="pln">repeat</span><span class="pun">;</span><span class="pln">z</span><span class="pun">-</span><span class="pln">index</span><span class="pun">:</span><span class="pln"> </span><span class="lit">10</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">.</span><span class="pln">hiding</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="pun">{</span><span class="pln">display</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">.</span><span class="pln">showing</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="pun">{</span><span class="pln">display</span><span class="pun">:</span><span class="pln">block</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre><p>My jQuery:</p><pre class="default prettyprint prettyprinted"><code><span class="pln">$</span><span class="pun">(</span><span class="pln">document</span><span class="pun">).</span><span class="pln">ready</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">var</span><span class="pln"> currentPosition </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="kwd">var</span><span class="pln"> slides </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">(</span><span class="str">'.slide'</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">var</span><span class="pln"> slideWidth </span><span class="pun">=</span><span class="pln"> </span><span class="lit">650</span><span class="pun">;</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">var</span><span class="pln"> numberOfSlides </span><span class="pun">=</span><span class="pln"> slides</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">var</span><span class="pln"> slideShowInterval</span><span class="pun">;</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">var</span><span class="pln"> speed </span><span class="pun">=</span><span class="pln"> </span><span class="lit">3000</span><span class="pun">;</span><span class="pln"></span><span class="com">//Assign a timer, so it will run periodically</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln">slideShowInterval </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="pln">changePosition</span><span class="pun">,</span><span class="pln"> speed</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">slides</span><span class="pun">.</span><span class="pln">wrapAll</span><span class="pun">(</span><span class="str">'<div id="slidesHolder"></div>'</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">slides</span><span class="pun">.</span><span class="pln">css</span><span class="pun">({</span><span class="pln"> </span><span class="str">'float'</span><span class="pun">:</span><span class="pln"> </span><span class="str">'left'</span><span class="pln"> </span><span class="pun">});</span><span class="pln"></span><span class="com">//set #slidesHolder width equal to the total width of all the slides</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln">$</span><span class="pun">(</span><span class="str">'#slidesHolder'</span><span class="pun">).</span><span class="pln">css</span><span class="pun">(</span><span class="str">'width'</span><span class="pun">,</span><span class="pln"> slideWidth </span><span class="pun">*</span><span class="pln"> numberOfSlides</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">$</span><span class="pun">(</span><span class="str">'#slideShowWindow'</span><span class="pun">)</span><span class="pln"></span><span class="pun">.</span><span class="pln">prepend</span><span class="pun">(</span><span class="str">'<span class="slideNav" id="leftNav">Move Left</span>'</span><span class="pun">)</span><span class="pln"></span><span class="pun">.</span><span class="pln">append</span><span class="pun">(</span><span class="str">'<span class="slideNav" id="rightNav">Move Right</span>'</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">manageNav</span><span class="pun">(</span><span class="pln">currentPosition</span><span class="pun">);</span><span class="pln"></span><span class="com">//tell the buttons what to do when clicked</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln">$</span><span class="pun">(</span><span class="str">'.slideNav'</span><span class="pun">).</span><span class="pln">bind</span><span class="pun">(</span><span class="str">'click'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"></span><span class="com">//determine new position</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln">currentPosition </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">$</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">attr</span><span class="pun">(</span><span class="str">'id'</span><span class="pun">)</span><span class="pln"> </span><span class="pun">===</span><span class="pln"> </span><span class="str">'rightNav'</span><span class="pun">)</span><span class="pln"></span><span class="pun">?</span><span class="pln"> currentPosition </span><span class="pun">+</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> currentPosition </span><span class="pun">-</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span><span class="pln"></span><span class="com">//hide/show controls</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln">manageNav</span><span class="pun">(</span><span class="pln">currentPosition</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">clearInterval</span><span class="pun">(</span><span class="pln">slideShowInterval</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">slideShowInterval </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="pln">changePosition</span><span class="pun">,</span><span class="pln"> speed</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">moveSlide</span><span class="pun">();</span><span class="pln"></span><span class="pun">});</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">function</span><span class="pln"> manageNav</span><span class="pun">(</span><span class="pln">position</span><span class="pun">)</span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="pun">{</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="com">//hide left arrow if position is first slide</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">position </span><span class="pun">===</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="pun">{</span><span class="pln">$</span><span class="pun">(</span><span class="str">'#leftNav'</span><span class="pun">).</span><span class="pln">hide</span><span class="pun">();</span><span class="pln"></span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">$</span><span class="pun">(</span><span class="str">'#leftNav'</span><span class="pun">).</span><span class="pln">show</span><span class="pun">();</span><span class="pln"></span><span class="pun">}</span><span class="pln"></span><span class="com">//hide right arrow is slide position is last slide</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">position </span><span class="pun">===</span><span class="pln"> numberOfSlides </span><span class="pun">-</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">$</span><span class="pun">(</span><span class="str">'#rightNav'</span><span class="pun">).</span><span class="pln">hide</span><span class="pun">();</span><span class="pln"></span><span class="pun">}</span><span class="pln"></span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">$</span><span class="pun">(</span><span class="str">'#rightNav'</span><span class="pun">).</span><span class="pln">show</span><span class="pun">();</span><span class="pln"></span><span class="pun">}</span><span class="pln"></span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="com">//changePosition: this is called when the slide is moved by the timer and NOT when the next or previous buttons are clicked</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="kwd">function</span><span class="pln"> changePosition</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"></span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">currentPosition </span><span class="pun">===</span><span class="pln"> numberOfSlides </span><span class="pun">-</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="pun">{</span><span class="pln">currentPosition </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">manageNav</span><span class="pun">(</span><span class="pln">currentPosition</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">currentPosition</span><span class="pun">++;</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">manageNav</span><span class="pun">(</span><span class="pln">currentPosition</span><span class="pun">);</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln"></span><span class="pun">}</span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="pun"></span><span class="pln">moveSlide</span><span class="pun">();</span><span class="pln"></span><span class="pun">}</span><span class="pln"></span><span class="com">//moveSlide: this function moves the slide </span></code></pre><pre class="default prettyprint prettyprinted"><code><span class="com"></span><span class="pln"></span><span class="kwd">function</span><span class="pln"> moveSlide</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">$</span><span class="pun">(</span><span class="str">'#slidesHolder'</span><span class="pun">).</span><span class="pln">animate</span><span class="pun">({</span><span class="pln"> </span><span class="str">'marginLeft'</span><span class="pun">:</span><span class="pln"> slideWidth </span><span class="pun">*</span><span class="pln"> </span><span class="pun">(-</span><span class="pln">currentPosition</span><span class="pun">)</span><span class="pln"> </span><span class="pun">});</span><span class="pln"></span><span class="pun">}</span><span class="pln"></span><span class="pun">});</span></code></pre><p>Thanks in advanced for your help guys, if you have any questions or require further info let me know :)<br /></p>
Reply
Answers (
1
)
Detect browser back button
Jquery tables events