I need to remove slides from a slider (made with iscroll) dynamically, but also need the slider to be able to 'refresh' or all the original slides to be put back in.
How is best to do this?
html looks like:
<div id="wrapper">
<div id="slider>
<div id="job-container1"><!-- slide 1 content here--></div>
<div id="job-container2"><!-- slide 2 content here--></div>
<div id="job-container3"><!-- slide 3 content here--></div>
</div>
</div>
js code to determine if I have less than 3 slides worth of info, therefore need to remove left over slides:
if(savedJobs.length === 1){
$('#job-container2, #job-container3').remove()
$('#slider').css('width','100%')
}else if(savedJobs.length === 2){
$('#job-container3').remove()
$('#slider').css('width','200%')
}else if(savedJobs.length >2){
//todo: check if its the last in the array also
}
I tried simply hiding the divs but the slider will still scroll to a blank slide even when myscroll.refresh() is called