View Full Version : [mootools] combining two effects?

Jun 13th, 2008, 01:47 PM
Hello everybody!

I have a problem that you might not want to fix. I hope I can help you decide by telling you what it is, and what I want with it. I'll give it a try. Because I'm not even a half-decent coder I just can't work it out. I'm trying to do the following:

I've got fx.scroll from a very, very fascinating site: http://www.melissahie.com. Ofcourse I have no intention of simply copying what she has so elegantly done, but I do want the same beautiful effect. I can't get the mootools original fx.scroll to work (http://demos111.mootools.net/Fx.Scroll) so I am currently using this one. Getting it to work was no real problem, as it works perfectly.

But now, I also want to add an accordion-effect (http://demos.mootools.net/Accordion) to a portion of a page, where I am also using the fx.scroll. The problem is, that it doesn't work. I can get both effects working, but not in a single document. Seperate from each other, they work good!

The problem has to be that I've got melissa's mootools.r420.js and I've got mootools.js that came with the accordion download. But what to do next?

I realise I cannot simply paste one into the other, and refering to both doesn't seem to work.

I've also tried to download the complete mootools.js and using that for both, but that I only thought that this would work, will tell you a lot about my skill.

Does anyone know how I can resolve this?

Jun 26th, 2008, 03:38 AM
You only need one version of MooTools, get the full latest from the site and use that one only.

The scroll effect is a simple one liner:

//taken from the example site's html
//define the scroll[skroll] element, which is the window
var skroll = new Fx.Scroll(window, {duration: 1500, wait: false, transition: Fx.Transitions.quadInOut});

//create the scroll actions
$('gotohome').addEvent('click', function(){ skroll.toElement('start'); });

Where gotohome and start are elements with those ids.

Clashing version of MooTools is most likey your problem. That or clashing ids.

Sidequestion - do you want to add the scroll effect to an accordion "page"?