I am having an issue with a simple slideshow that I made using jQuery. The script works fine in all other browsers except Google Chrome. You can find the live site here
There are two things wrong with it:
- The slide auto starts but stops after the second slide.
- If you click on the slide indicators (....), sometimes the background-image of that slide (which is applied via CSS) appears and sometimes it remains hidden.
On top of all that, I get this error:
event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
Here is the JavaScript I am using:
function nextSlide() {
var visibleSlide = $('#slider li:visible');
var currentSlide = $(visibleSlide).index() + 1;
var slideCount = $('#slider li').size();
var nextSlide = (currentSlide == slideCount) ? 1 : currentSlide + 1;
$('#slider_indicator a').removeClass('active');
$(visibleSlide).fadeOut('fast', function() {
$('#slider li:nth-child(' + nextSlide + ')').fadeIn('fast');
$('#slider_indicator li:nth-child(' + nextSlide + ') a').addClass('active');
});
}
autoslide = setTimeout("nextSlide()", 6000);
$(function() {
$('#slider_indicator a').bind('click', function(e) {
clearTimeout(autoslide);
$('#slider_indicator a').removeClass('active');
$(this).addClass('active');
var slide_number = $(this).parent().index() + 1;
$('#slider li:visible').fadeOut('fast', function() {
$('#slider li:nth-child(' + slide_number + ')').fadeIn('fast');
});
e.preventDefault();
})
$('#selection .scrollable .items a').live('click', function(e) {
var self = $(this);
$.ajax({
url: $(self).attr('href'),
type: 'GET',
success: function(body) {
var count = $('#selection .scrollable .items a').length - 1;
count = (count == 1) ? count + ' Ribbon' : count + ' Ribbons';
$(self).parent('li').fadeOut('fast', function() {
$('#result li a[rel="' + $(self).attr('rel') + '"]').removeClass('added');
$(this).remove();
$('#selection #header #count').text(count);
})
}
})
e.preventDefault();
})
})
Any help is greatly appreciated.
firefox 10.0.1
too – diEcho