Use toggle. It will switch the visibility of the selected elements.

Blair

On 11/17/06, Lucien Stals <[EMAIL PROTECTED]> wrote:

So easy when you know how :)

Now I have...

    $("span.singleEventTitle").click(function()
    {
        $(this).next().show("slow");

        //$(this).find("~ div:visible").hide("slow");
        //$(this).find("~ div:hidden").show("slow");

        return false;
    });

The commented out bits were kind of working, except they expanded *all*
siblings. I like this new version better.

But now I need to know how to *hide* them again with a second click. This
seems an obvious thing, and I've seen examples of it being done using
ID's,
but I don't have ID's and am not sure how to go about it.

The html it's being applied to is dynamically generated from an RSS feed
using hCalendar microformat information, but it looks something like...

<div class="theMonth"><span class="i">February 2006</span><br/>

<span class="singleEventTitle">Wed 8 : Information session 12:30pm</span>
<div class='vevent x-wpsb-simple-event'>
<h3 class='summary'>ADS information session (Prahran)</h3>
<p><b>Begins</b>: <abbr class='dtstart' title='2006-02-08T12:30:00'>Wed,
08
Feb 2006 at 12:30 PM</abbr></p>
<p><b>Ends</b>: <abbr class='dtend' title='2006-02-08T12:30:00'>Wed, 08
Feb
2006 at  1:30 PM</abbr></p>
<p>            <b>Location</b>:            <span class='location'>
</p>

<p>                    </span></p>
</div>

There are quite a few of these kind of blocks on the page.

Thanks,

Lucien.


On 17/11/06 12:56 PM, "Karl Swedberg" <[EMAIL PROTECTED]> wrote:

> Hi Lucien,
>
> Welcome to the jQuery mailing list!
>
> You're on the right track, but instead of doing this:
>
> $("this.following-sibling").slideDown("slow");
>
> try this:
>
> $(this).next().slideDown("slow");
>
> --Karl
>
> _______________________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
>
> On Nov 16, 2006, at 6:48 PM, Lucien Stals wrote:
>
>> Hi everyone,
>>
>> (Yes, I'm a newbie to jQuery)
>>
>> I have the following in my page...
>>
>> $(document).ready(function()
>> {
>> $("div.singleEvent").hide();
>>
>> $("span.singleEventTitle").click(function()
>> {
>> $("div:hidden").slideDown("slow");
>> return false;
>> });
>> });
>>
>> Now this works to hide all the "singleEvent" div, but what I want
>> is to
>> show (slideDown) the previously hidden body of an event when somebody
>> clicks on the still visible event title. But I'm just not getting the
>> expression language. How do I select the following sibling of the
>> event
>> title that was clicked so that not *all* of the hidden elements are
>> show
>> at once?
>>
>> I imagined it was something like...
>>
>> $("following-sibling").slideDown("slow");
>> or
>> $("this.following-sibling").slideDown("slow");
>>
>> But they just aren't working for me :(
>>
>>
>> In the html, the events look something like...
>>
>> <span class="singleEventTitle">title</span>
>> <div class="singleEvent">event details</div>
>>
>> --
>>
>> Lucien Stals
>> Multimedia/Web Developer
>> Academic Development and Support
>> Swinburne University of Technology
>> PO Box 218 Hawthorn, 3122, Australia
>> email: [EMAIL PROTECTED]
>> telephone: +61 3 9214 4474
>> office: AD(s)223
>>
>>
>> Education is only the beginning.
>> Let's get on with it.
>>
>> Swinburne University of Technology
>> CRICOS Provider Code: 00111D
>>
>> NOTICE
>> This e-mail and any attachments are confidential and intended only
>> for the use of the addressee. They may contain information that is
>> privileged or protected by copyright. If you are not the intended
>> recipient, any dissemination, distribution, printing, copying or
>> use is strictly prohibited. The University does not warrant that
>> this e-mail and any attachments are secure and there is also a risk
>> that it may be corrupted in transmission. It is your responsibility
>> to check any attachments for viruses or defects before opening
>> them. If you have received this transmission in error, please
>> contact us on +61 3 9214 8000 and delete it immediately from your
>> system. We do not accept liability in connection with computer
>> virus, data corruption, delay, interruption, unauthorised access or
>> unauthorised amendment.
>>
>> Please consider the environment before printing this email.
>>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/

--
Lucien Stals
Web Developer
Academic Development and Support
Phone +61 3 9214 4474
Email [EMAIL PROTECTED]



Education is only the beginning.
Let's get on with it.

Swinburne University of Technology
CRICOS Provider Code: 00111D

NOTICE
This e-mail and any attachments are confidential and intended only for the
use of the addressee. They may contain information that is privileged or
protected by copyright. If you are not the intended recipient, any
dissemination, distribution, printing, copying or use is strictly
prohibited. The University does not warrant that this e-mail and any
attachments are secure and there is also a risk that it may be corrupted in
transmission. It is your responsibility to check any attachments for viruses
or defects before opening them. If you have received this transmission in
error, please contact us on +61 3 9214 8000 and delete it immediately from
your system. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment.

Please consider the environment before printing this email.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to