Script doet niets

Status
Niet open voor verdere reacties.

hawky

Gebruiker
Lid geworden
9 aug 2008
Berichten
114
Ik heb maar wat in elkaar proberen te zetten, wat ik nodig heb. maar het werkt blijkbaar niet.

$(function() {
var max = 240;
var offset = 0;
$('body').css("background-position", "left " + "top");

function scrollbackground(){
setTimeout(function(){rechts();}, 3000);
function rechts(){
if (!(offset==max)){
offset + 1;
$('body').css("background-position", offset + "px " + "top");
setTimeout(function(){rechts();}, 100);
}
};
setTimeout(function(){links();}, 3000);
function links(){
if (!(offset==0)){
offset - 1;
$('body').css("background-position", offset + "px " + "top");
setTimeout(function(){links();}, 100);
}
};
}
});

Zou iemand hier een werkende versie van kunnen maken?:thumb:

Gr Brecht
 
eh, wat werkt er precies niet? En heb je die jQuery dingen wel? (of welke jslib het dan ook is)
 
Eum, hij doet helemaal niet. En hij gebruikt jquery, maar dat mag er ook wel uit.
 
Opgelost:
Code:
$(function backgroundimage(){
   	   	var	max = -(1920 - screen.width);
   	   	offset = Math.round(Math.floor(Math.random()* max));
   		document.getElementsByTagName('body')[0].style.backgroundPosition = 'left top';
    
    rechts();
	function rechts() {
	   	if (offset!=max){
	   	offset=offset - 1;
   		document.getElementsByTagName('body')[0].style.backgroundPosition = ''+offset+'px top';
   		setTimeout(function() {rechts();}, 100);
   	}
   	else{
   	links();
   	function links() {
	   	if (offset!=0){
	   	offset=offset + 1;
   		document.getElementsByTagName('body')[0].style.backgroundPosition = ''+offset+'px top';
   		setTimeout(function() {links();}, 100);
   	}
   	else{rechts();}
   	}}}
});
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan