using PHP im reading directories and then displaying all the .pdf files within that directory. On the page being displayed is multiple directories shown at once.
I have a script i borrowed then modified that allows scrolling through each directory.
The issue is that it scrolls all the displayed folders. (i can see why it does it) and the counter counts all the elements.
I need to modify so that the script is assigned to each directory element and calls only itself. I just dont know how to do it.
HTML
[HTML]
<div class="gal">
<div class="counter"></div>
<div class="left_arrow"></div><div class="right_arrow"></div>
<div class="slider">
<div class="pdf">1</div>
<div class="pdf">2</div>
<div class="pdf">3</div>
<div class="pdf">4</div>
<div class="pdf">5</div>
<div class="pdf">6</div>
<div class="pdf">7</div>
<div class="pdf">8</div>
</div>
</div>
<div class="gal">
<div class="counter"></div>
<div class="left_arrow"></div><div class="right_arrow"></div>
<div class="slider">
<div class="pdf">1</div>
<div class="pdf">2</div>
<div class="pdf">3</div>
<div class="pdf">4</div>
<div class="pdf">5</div>
<div class="pdf">6</div>
<div class="pdf">7</div>
<div class="pdf">8</div>
</div>
</div>
//Etc etc
[/HTML]
[CODE]
$(function() {
var c = 1,
boxw = $('.pdf').outerWidth(true),
boxn = $('.pdf').length;
$('.slider').width(boxw*boxn);
//////////////////////////////////
function b(){
cc = (c === 1) ? $('.left_arrow').hide() : $('.left_arrow').show();
ccc =(c >= boxn) ? $('.right_arrow').hide() : $('.right_arrow').show();
}
b();
/////////////////////////////////
function a(cb){
$('.slider').animate({left: '-'+ (boxw)*(c-1) },800, cb);
}
/////////////////////////////////////////////////////////////////
function counter(){
$('.counter').html(c+'/'+boxn);
}
counter();
/////////////////////////////////////////////////////////////////
$('.right_arrow').click(function() {
c++;
b();
a();
counter();
});
$('.left_arrow').click(function() {
c--;
b();
a();
counter();
});
});
[/CODE]
please help this noob!