How do I create a delay with MooTools?
I'm more of a jquery guy, and not too familiar with MooTools. I've read up on creating a delay on the MooTools site, but I'm afraid I'm not savvy enough to add it to my script.
After the page loads, I want to add a 300ms delay before this happens:
window.addEvent('domready', function(){
var data = {};
var myShow = new Slideshow.delay(1000)('show', null, {controller: true, height: 467, hu: 'half-moon-bay-wedding/', thumbnails: true, width: 730, loop:false});
});
I'm thinking this is probably simple stuff to someone who knows MooTools well? Thank you for your help and th开发者_运维知识库oughts!
You could for instance try:
window.addEvent('domready', function() {
var data = {};
(function() {
var myShow = new Slideshow('show', null, {controller: true, height: 467, hu: 'half-moon-bay-wedding/', thumbnails: true, width: 730, loop:false});
}).delay(300);
});
This way, your SlideShow call will be wrapped in an anonymous function, that will be called as soon as the delay of 300 ms has passed.
More info can of course be found in the docs: http://mootools.net/docs/core/Types/Function#Function:delay
精彩评论