Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery – selecting something that is clicked

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #23818
    brianatlarge
    Member

    Website: http://stuckpixelstudio.com/clients/cro … stries.php

    So what I’m going for is when you click on a header with the class ".ministriestitle" , the contents in a paragraph with the class ".ministrydetail" slides down, and when you click it again it slides back up. I was able to make this work fine, but whenever you would click on one of the headers, ALL of the paragraphs would show. So, by referencing my "Learning jQuery" book, I tried to combine some (function(event) stuff with my .toggle thing, but I can’t seem to get it to work. I dunno if I’m missing a parenthesis or a bracket, or if there is something wrong with how I’m doing this. So, here’s the code:

    Code:
    $(document).ready(function()
    $(‘.ministriestitle’).toggle(function(event) {
    if (event.target == this) {
    $(‘.ministrydetail’).slideDown(‘fast’);
    }, function() {
    $(‘.ministrydetail’).slideUp(‘fast’);
    }
    });
    });

    Thanks guys.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.