Community discussion forum

Problem with jquery selectors.

  • 23 days ago

    I am trying to use this jquery slide function that i found online. It's a very basic slide plugin i suppose, which selects a div using the div's id tag. I wanted to make my menu hide/reveal multiple divs and therefore I modified this function that I keep in my .js file to make things work theoretically. But for some reason I cannot get this to work and I think that it might be that my selectors are implemented wrong in my js file. Here is an example of what I've got which seems to work except for when I try my modified code:

    $(document).ready(function() {

        $(".fadeNext_home").click(function(){  
    
                $("#home").fadeSliderToggle()
    
                 return false;
    
        })
    

    });

    This is the code that works in my js file:

        caller = this
    

    if($(caller).css("display") == "none"){

    $(caller).animate({

    opacity: 1,

    height: 'toggle'

    }, settings.speed, settings.easing);

        }else{
    
                $(caller).animate({
    

    opacity: 0,

    height: 'toggle'

    }, settings.speed, settings.easing);

        }
    

    };

    And this is a modified version with my own selector that does not work. And I think it's because of the way that I'm trying to interact with an id tag that was not passed to the js file:

        if($(caller).css("display") == "none"){
    
    
    
                if($("#home").css("display") != "none"){
    
                        $("#home").animate({
    
                                opacity: 0,
    
                                height: 'toggle'
    
                        }, settings.speed, settings.easing);
    
                }
    

    I'm new to jquery (obviously) and would appriciate any help. Thanks so much!

    thanks, wes

    Post was edited on 03/11/2009 03:27:54 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!