I'm new in jquery and i'm trying to make a slider with jquery here is my script for now:
$(function()
{
var bgCounter = 0,
text = [
'some html code here',
'some html code here',
'some html code here',
],
link = [
'LINK',
'LINK',
'LINK'
],
backgrounds = [
"img.jpg",
"img.jpg",
"img.jpg"
];
function changeBackground()
{
bgCounter = (bgCounter+1) % backgrounds.length;
$('#Main-screen').css('background', 'url('+backgrounds[bgCounter]+')');
$('#Main-screen').css('background-size','cover');
$('#example').html(text[bgCounter]);
$('a.link').attr("href", "#"+link[bgCounter]);
setTimeout(changeBackground,4000);
}
changeBackground();
})();
And this is the html/css part :
#Main-screen {
position: relative;
width:100%;
height: 100%;
<div id="Main-screen" style="display:inline-block;">
<a class="link" href="#"><span id="example"></span></a>
I don't know if with this script i can add an effect (like fade) when my image is switching and add a next/prev link on this. So if anyone have an idea to do this. I realy don't know if ths is possible with my script. So if this isn't possible can anyone show me with an exemple it would be realy great.
Sorry my english is not very good.