Here's a cut-down version of the code generated by my NewsCycle plug- in for Softpress Freeway.

document.observe('dom:loaded',function(){
        var newsSource = $('yourListId');
        var delayBetweenItems = 3;
        var effectSpeed = 0.6;
        var tag = newsSource.firstDescendant().tagName.toLowerCase();
        var data = newsSource.select(tag).invoke('hide').pluck('innerHTML');
        var news = newsSource.down(tag).show();
        var index = 0;
        var newsCycle = function(){
                index = (++index >= data.length ? 0 : index)
                new Effect.Fade(news,{
                        delay:delayBetweenItems,
                        duration:effectSpeed,
                        afterFinish:function(){
                                new Effect.BlindDown(news,{
                                        duration:effectSpeed,
                                        beforeStart:function(){
                                                news.update(data[index]);
                                        },
                                        afterFinish:newsCycle
                                });
                        }
                });
        };
        newsCycle();
});


You need prototype and scriptaculous effects in the page first, obviously, and you need to fill in the id of your list. My plug-in has extra code to make it "list agnostic", so you could simplify this a lot if you knew that your effect was only ever being applied to a list. You could also use this as written on a DIV with a bunch of P tags in it, or a DIV with a bunch of DIVs in it -- there's no end to the possible combinations.

Walter

On Mar 11, 2011, at 11:35 AM, PartisanEntity wrote:

Hi all,

I am relatively new to scriptaculous and would like to know if the
following is possible.

I would like to create a list of news items on my website.

Instead of showing all items in my <ul> list, I would like for each
item to appear using the slide "down effect", then for it to disappear
and for the next item to appear by sliding down.

Is this possible?

Has this been done before, perhaps there is some code I could copy as
I have no idea how to build something like this.

Thank you very much for you time and effort.

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en .


--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to