Jquery -> Mootools

Status
Niet open voor verdere reacties.

hawky

Gebruiker
Lid geworden
9 aug 2008
Berichten
114
Ik ben een website aan het maken en ik heb een paar leuke javascriptjes gevonden op internet. Deze gebruiken Mootools ofwel Jquery. Maar nu werken sommige scriptjes niet meer omdat Mootools EN Jquery in mijn website staan. Kan iemand dit script omzetten van Jquery naar een Mootools ondersteunt script zodat ik Jquery kan verwijderen?:)

Code:
$(function() {
	// Define the height of your two background images.
           //The image to scroll
	   var backgroundheight = 2000;
           //The image to overlay
	   var backgroundheight_two = 1000;

	// Create a random offset for both images' starting positions
        offset = Math.round(Math.floor(Math.random()* 2001));
 
	function scrollbackground() {
                //Ensure all bases are covered when defining the offset.
   		offset = (offset < 1) ? offset + (backgroundheight - 1) : offset - 1;
		// Put the background onto the required div and animate vertically
   		$('#banner').css("background-position", "50% " + offset + "px");
   		// Enable the function to loop when it reaches the end of the image
   		setTimeout(function() {
			scrollbackground();
			}, 100
		);
   	}
	function scrollbackground2() {
                //Ensure all bases are covered when defining the offset.
   		offset = (offset < 1) ? offset + (backgroundheight - 1) : offset - 1;
		// Put the background onto the required div and animate vertically
   		$('#banner').css("background-position", "50% " + offset + "px");
   		// Enable the function to loop when it reaches the end of the image
   		setTimeout(function() {
			scrollbackground2();
			}, 100
		);
   	}
	// Initiate the scroll
	scrollbackground();
	scrollbackground2();
});

Alvast bedankt
 
Ja maar...[JS]$('#banner').css("background-position", "50% " + offset + "px");
[/JS]is toch de enige regel die aangepast moet worden??:confused:

Kun je dat niet zelf? De rest is volgens mij gewoon core JS hoor...

Gr. Robin
 
Die heb al aangepast naar gelang mijn website, hij werkt ook. Alleen geeft hij nu een probleem tussen Mootools en Jquery. Ik zou alles graag in Mootools script hebben staan:)
 
Sorry, ik had je verkeerd begrepen:)
zou het daarmee opgelost zijn?

Maar ik weet niet hoe ik dat moet vertalen, anders zou ik het niet op dit forum zetten:D
 
zoek het even op dan..
ik snap dat je niet alles wilt vertalen (opzoeken), maar het is maar 1 regel, de rest werkt ook zonder jQuery.
 
Zou het zoiets kunnen zijn?
Code:
$(#banner).setStyle('background-position','center' + offset + 'px');

of

Code:
$('#banner').setStyle({background-position:'center '+ offset + 'px'});

Deze 2 heb ik geprobeerd, maar ze werken niet. Ook de rest van het scriptje doet het niet meer zonder Jquery.
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan