Is there a way to hide the .prev button when it is the first one? Also, why does the slider go back to the first slide when the .prev button is clicked at the last slide? How can this issue be resolved?
var nextPane = function (e) {
e && e.preventDefault();
var $container = $(this).closest('.grid-container');
var $items = $('.items', $container);
var offset = $items.css('marginLeft').replace('px', '');
var width = $container.width() + parseInt($('.item', $container).css('marginRight').replace('px', ''));
$items.css('marginLeft', offset - width);
if($(this).parent().find('.items').width() + (offset - width) < width){
$(this).hide();
}
}
var prevPane = function (e) {
e && e.preventDefault();
var $container = $(this).closest('.grid-container');
var $items = $('.items', $container);
var offset = $items.css('marginLeft').replace('px', '');
var width = $container.width() + parseInt($('.item', $container).css('marginRight').replace('px', ''));
$items.css('marginLeft', offset + width);
if($('.next').is( ":hidden" )){
$(this).parent().find('.next').show();
}
}