Hello,
Im not sure what is wrong with my script : | When i alert new background styles, it looks ok. When i click #go1, background disappears, but than appears same background : / I want to change it to bg+l+.jpg where l is number of background (i have 4 backgrounds).
Script:
- <div id="inner" style="background:url(bg1.jpg) no-repeat center">Jakis tekst</div>
- <script>
- var l = 1;
- var str = "url(bg"+l+".jpg) no-repeat center";
- $('#go1').click( function(){
- $('#inner').fadeOut( 'slow', function(){
- l=l+1;
- if(l==5) {l=1;}
- str = "url(bg"+l+".jpg) no-repeat center";
- document.write(str);
- document.getElementById('inner').style.background = str;
- })
- });
- </script>