Thank you all for your replies. Carl, I tried yours but nothing
happens when clicking previous. Anyway, thanks to a friend of mine,
here is the correct code (or at least, the code that works) in case
anybody wonders:

$(".gallery").prepend("<li>pek</
li>").children("li:first").hide().slideDown("slow");

Don't ask me how or why, it just works! ;) I'm trying to figure it out
right now. ;)

Once again, thank you for your feedback.
Panagiotis


On Jul 3, 11:08 pm, Carl Von Stetten <[EMAIL PROTECTED]> wrote:
> pek,
>
> Try this (untested):
>
> $("<li>testing</li>").hide().insertBefore("#gallery
> li:first").slideDown("slow");
>
> Carl
>
> pek wrote:
> > First of all, thank you very much for the reply. It is really hard to
> > get any reply in this mailing list. This is the third time I'm asking
> > something and you are the first to answer.
>
> > Unfortunately, I've tried this and it kinda acts weird. Instead of
> > wrapping the <li>testing</li> with the effect, it wraps the next
> > element, so now the second does the slideDown effect. You can see this
> > here:
> >http://treazy.com/pek/album/
> > Just click previous and watch what happens. Do you know how to work
> > around this?
>
> > Thanks again.
>
> > On Jul 3, 10:30 pm, real <[EMAIL PROTECTED]> wrote:
>
> >> This is what you would want to do:
> >> $("#gallery li:first").before("<li>testing</
> >> li>").hide().slideDown("slow")
>
> >> On Jul 3, 11:51 am, pek <[EMAIL PROTECTED]> wrote:
>
> >>> I have a small problem when dealing with effects. Warning: Noob
> >>> question ahead.
>
> >>> Currently I have a list of items
> >>> <ul id="gallery">
> >>>   <li>test</li>
> >>>   <li>test2</li>
> >>> </ul>
>
> >>> alert($("#gallery li:first").html()) will correctly echo "test".
> >>> If I want to add a new element before that with a slideDown effect, I
> >>> use this line:
> >>> $("#gallery li:first").before().html("<li>testing</
> >>> li>").hide().slideDown("slow")
>
> >>> Although this correctly adds the line and smoothly slides it down, now
> >>> the list is like this:
> >>> <ul id="gallery">
> >>>   <li style="display: block;">
> >>>     <li>testing</li>
> >>>   </li>
> >>>   <li>test</li>
> >>>   <li>test2</li>
> >>> </ul>
>
> >>> The extra li with the style is added by jQuery for the effect. This
> >>> isn't a problem until you want again to add something before the first
> >>> element.
> >>> Now alert($("#gallery li:first").html()) incorrectly (well, correctly,
> >>> but not what I want anyway) returns "<li>testing</li>" instead of
> >>> "testing" which means that if I try to do the same effect with the
> >>> same code it will not add before, rather, it will replace it and do
> >>> the effect again.
>
> >>> Any help?
>
> >>> Thank you in advance.
> >>> Panagiotis

Reply via email to