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.
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.
My html:
Code
<div id="slideShow">Code
<div id="slideShowWindow">Code
<div class="slide">
<img src="../Images/golden.jpg"/>Code
<div class="slideText">CSS
<h2>Golden pearl</h2> <p>This golden pearl came from a farm in the south china sea</p>HTML / XML
</div> <!-- </slideText> --></div><!-- </slide> repeat as many times as needed -->Code
<div class="slide"><img src="../Images/zen.jpg"/>Code
<div class="slideText">Code
<h2>Simply Zen</h2>Code
<p>What else is there to say?!</p>HTML / XML
</div> <!-- </slideText> -->HTML / XML
</div><!-- </slide> repeat as many times as needed -->Code
<div class="slide"><img src="../Images/rain.jpg"/>Code
<div class="slideText"><h2>Lariat In 'Rain'</h2>Code
<p>Lariat In 'Rain' motif using diamonds, white gold, Tahitian pearls, and silk.</p>HTML / XML
</div> <!-- </slideText> -->HTML / XML
</div><!-- </slide> repeat as many times as needed -->HTML / XML
</div> <!-- </slideShowWindow> -->HTML / XML
</div> <!-- </slideshow> -->My css:
CSS
img {display: block;width: 100%;height: auto;
}CSS
p{background:none;color:#ffffff;
}Code
#slideShow #slideShowWindowCSS
{width: 650px;height: 450px;margin: 0;padding: 0;position: relative;overflow:hidden;margin-left: auto;margin-right:auto;
}Code
#slideShow #slideShowWindow .slideCSS
{margin: 0;padding: 0;width: 650px;height: 450px;float: left;position: relative;margin-left:auto;margin-right: auto;}#slideshow #slideshowWindow .slide{position:absolute;bottom:18px;left:0;width:100%;height:auto;margin:0;padding:0;color:#ffffff;font-family:Myriad Pro, Arial, Helvetica, sans-serif;
}Code
.slideTextCSS
{background: rgba(128, 128, 128, 0.49);text-align:center;bottom:0;padding:10px;
}Code
#slideshow #slideshowWindow .slide .slideText h2,
#slideshow #slideshowWindow .slide .slideText pCSS
{margin:10px;padding:15px;
}.slideNav {display: block;text-indent: -10000px;position: absolute;cursor: pointer;
}
#leftNavCSS
{left: 0;bottom: 0;width: 48px;height: 48px;background-image: url("../Images/plus_add_minus.png");background-repeat: no-repeat;z-index: 10;
}Code
#rightNavCSS
{right: 0;bottom: 0;width: 48px;height: 48px;background-image: url("../Images/plus_add_green.png");background-repeat: no-repeat;z-index: 10;
}
.hidingCode
{display:none;
}
.showingCode
{display:block;
}My jQuery:
Code
$(document).ready(function () {Code
var currentPosition = 0;Code
var slides = $('.slide');Code
var slideWidth = 650;Code
var numberOfSlides = slides.length;Code
var slideShowInterval;Code
var speed = 3000;//Assign a timer, so it will run periodicallyCode
slideShowInterval = setInterval(changePosition, speed);Code
slides.wrapAll('<div id="slidesHolder"></div>');Code
slides.css({ 'float': 'left' });//set #slidesHolder width equal to the total width of all the slidesCode
$('#slidesHolder').css('width', slideWidth * numberOfSlides);HTML / XML
$('#slideShowWindow').prepend('<span class="slideNav" id="leftNav">Move Left</span>').append('<span class="slideNav" id="rightNav">Move Right</span>');Code
manageNav(currentPosition);//tell the buttons what to do when clickedJavaScript
$('.slideNav').bind('click', function () {//determine new positionCode
currentPosition = ($(this).attr('id') === 'rightNav')? currentPosition + 1 : currentPosition - 1;//hide/show controlsCode
manageNav(currentPosition);Code
clearInterval(slideShowInterval);Code
slideShowInterval = setInterval(changePosition, speed);Code
moveSlide();});Code
function manageNav(position)Code
{Code
//hide left arrow if position is first slideCode
if (position === 0)Code
{$('#leftNav').hide();}JavaScript
else {$('#leftNav').show();}//hide right arrow is slide position is last slideCode
if (position === numberOfSlides - 1) {$('#rightNav').hide();}else {$('#rightNav').show();}}C#
//changePosition: this is called when the slide is moved by the timer and NOT when the next or previous buttons are clickedCode
function changePosition() {if (currentPosition === numberOfSlides - 1)Code
{currentPosition = 0;Code
manageNav(currentPosition);Code
} else {Code
currentPosition++;Code
manageNav(currentPosition);Code
}Code
moveSlide();}//moveSlide: this function moves the slideCode
function moveSlide() {$('#slidesHolder').animate({ 'marginLeft': slideWidth * (-currentPosition) });}});Thanks in advanced for your help guys, if you have any questions or require further info let me know :)


Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 8, 2016, 9:53 AM EDT