la documentazione di qualsiasi script, dal piu' semplice al piu' complesso, va letta attentamente
prima di tutto mootools e' modulare, al momento del download tu scegli con cosa comporre il file che andrai a scaricare, se lasci solo il core te ne farai ben poco
tu clicca su Fx.Scroll e lui automaticamente aggiungera' tutte le sottoparti da cui dipende il funzionamento di quel modulo
aggiungi manualmente Fx.Transitions e Window.DomReady (per motivi che ti saranno presto ben chiari) ed effettua il download
nel tuo documento, nell' ordine:
- includi il css
- includi mootools che hai appena scaricato
- in un blocco di <script> nel documento stesso o in un js esterno che andrai a includere scrivi
codice:
window.addEvent('domready', function() {
var scroll = new Fx.Scroll('demo-wrapper', {
wait: false,
duration: 2500,
offset: {'x': -200, 'y': -50},
transition: Fx.Transitions.Quad.easeInOut
});
$('link1').addEvent('click', function(event) {
event = new Event(event).stop();
scroll.toElement('content1');
});
$('link2').addEvent('click', function(event) {
event = new Event(event).stop();
scroll.toElement('content2');
});
$('link3').addEvent('click', function(event) {
event = new Event(event).stop();
scroll.toElement('content3');
});
$('link4').addEvent('click', function(event) {
event = new Event(event).stop();
scroll.toElement('content4');
});
});
- l' xhtml che prendi dall' esempio
questo window.addEvent('domready', function() { lo devi aggiungere perche', come spiegato nella documentazione ai singoli esempi ( http://demos.mootools.net/ )
The js code contains the JavaScript code of the demo.
NOTE: All demos EXCEPT DomReadyVS.Load are wrapped inside a "domready" which is not included in the js code you see. (You can see it by viewing at page's actual source code). This means the following is the actual content of the page:
window.addEvent('domready', function() {
// HERE IS WHAT YOU READ IN JS CODE
});
If you are going to reproduce the demo, remember the domready event! (More info about this topic is available here and here).
e questo spiega perche' nel download hai dovuto aggiungere il modulo Window.DomReady
l' altro invece lo aggiungi perche' nello script e' scritto
transition: Fx.Transitions.Quad.easeInOut
e funzionera'
ciao