$(function()
{
var list = $('#ulGall li');
currentItem = 0;
function changeToSlide(index)
{
var i = index;
var nextImage = "url(" + $('#ulGall img' + ':eq(' + i +')').attr('src');
$('#gall').css('background-image', nextImage);
}
$('#gRight').click(function()
{
var i = currentItem;
if ( i < (list.length - 1))
{
changeToSlide(i+1);
currentItem += 1;
}
else
{
changeToSlide(0);
currentItem = 0;
}
$("#gInfo").hide();
});
changeToSlide(0); // this is the starting background of #gall
});
This code is on a separate file and it changes background image of #gall (click on #gRight)
It works perfectly in Firefoks, but not in IE8 and Chrome.
I have another jQuery functions in the same file and – they work in IE and Chrome.
Not tested in Opera and Safari.
How can I make this code to be cross-browser
Seems to be missing the ending closing brace
This might affect the way it works in
IE-8as bad HTML might mess it up..If the
HTML is not properly formedthen it might not render in the first place.Also you have an extra closing parenthesis in the end..
});.. Remove that as well