code working only in FF and Opera
every other browser fails. there's got to be a simple explanation for this. code:
$(document).ready(function() {
$('.next').click(function() { nextSlide(); return false });
$('.back').click(function() { prevSlide(); return false });
setInterval ( 'nextSlide()'
, 9000 // duration
);
});
function nextSlide() {
//alert('"NEXT" called');
// get the current 'left' position of the div
oPosition = $('.items').css('left');
// strip the 'px' off of the value, for use in calculation
posCalc = oPosition.indexOf("px");
// current 'left' position, sans 'px' - parseInt turns the string into an integer
rPosition = parseInt(oPosition.substr(0,posCalc),10);
// new 'left' position is the current 'left' position plus 677px (width of image)
//mValue = rPosition + 677;
// mValue = -mValue;
//alert('Real position is '+rPosition);
if(rPosition == -2708){
newLeft = 0;
} else {
newLeft = (-rPosition)+677;
}
//alert('New position is '+newLeft);
$(".items").animate({
left: -newLeft
}, "slow" );
return false;
}
function prevSlide() {
//alert('"NEXT" called');
// get the current 'left' position of the div
oPosition = $('.items').css('left');
// strip the 'px' off of the value, for use in calculation
posCalc = oPosition.indexOf("px");
// current 'left' position, sans 'px' - parseInt turns the string into an integer
rPosition = parseInt(oPosition.substr(0,posCalc),10);
// new 'left' position is the current 'left' position plus 677px (width of image)
//mValue = rPosition + 677;
// mValue = -mValue;
//alert('Real position is '+rPosition);
if(rPosition == 0){
newLeft = 2708;
} else {
newLeft = (-rPosition)-677;
}
//alert('New position is '+newLeft);
$(".items").animate({
left: -newLeft
}, "slow" );
return false;
}