I am relatively new to jQuery and for the life of me can't come up with a working solution to a project of mine. My goal is to use the animate method on specific selector. This 'specific selector' needs to be created based on the initial toggler's URL.
<div id="wrapper"> <div class="panel project_one"> <p>Some html tags and images</p> </div> <div class="panel project_one"> <p>Some html tags and images</p> </div> </div>
The idea is to have all the classes (.panel) initiall hidden. When a user clicks a link from the unordered list, the jquery shows the panel that has a class name that matches the respected unordered list hyperlink reference.
Again, I don't really have a thurough understanding of jQuery at this point but my assumption is the logic would be something like this:
Thanks Jay. Based on your response, I'm wondering then if you have any other ideas that would make this more agile rather than adding the substring method? Should I create some other attribute within the hyperlink that would mimic the correct class for it's respected .panel div?
Thanks Kevin, this should work great. I was under the impression that creating variables was considered bad-practice but I'm not even real sure where or what led me to believe that. It would be nice if I could just apply the ".panel." + this.href.split("#"); to the selector rather than the variable named targetSelector but knowing now what I do, this option should work just fine. Thanks again!