[jQuery] Re: Simple toggle question…

2008-09-11 Thread [EMAIL PROTECTED]
I think this is not very perfect. what do you think of this? $(document).ready(function(){ $("#thing").toggle(function(){ function () { $("#resultsview").removeClass('list').addClass('gallery'); }, function () { $("#resultsview").removeClass('gallery').addClass('list');

[jQuery] Re: Simple toggle question…

2008-09-11 Thread seangates
Rewritten: --- .gallery {background:red;} .list {background:green;} $(document).ready(function(){ $("#thing").click(function(){ $("#resultsview").toggle( function () {

[jQuery] Re: Simple toggle question…

2008-09-10 Thread Karl Swedberg
Ha! Great catch, Nathan! Can't believe I missed that one myself. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Sep 10, 2008, at 12:12 PM, Nathan wrote: You need quotes around all selectors. So $(#resultsview) should be $ ("#resultsview") Also, I would

[jQuery] Re: Simple toggle question…

2008-09-10 Thread Nathan
You need quotes around all selectors. So $(#resultsview) should be $ ("#resultsview") Also, I would download/use Firebug, as it will provide meaningful error messages in the console which you will learn and/or can paste to forum messages like this... -Nate On Sep 10, 9:46 am, unremarkable <[

[jQuery] Re: Simple toggle question…

2008-09-10 Thread ryanstreet
Usually, (but not always), a toggle() is used in an onclick action. Usually it is used to show or hide an element. Try something more like this: click blah blah This way, everything within the div will be hidden or shown when you click on the link. I hope this helps!! O

[jQuery] Re: Simple toggle question…

2008-09-10 Thread Karl Swedberg
//Can't see anything obviously wrong with your code, but you could do it this way instead: $(document).ready(function(){ $("#thing").click( function () { $(#resultsview).toggleClass('gallery'); }); }); Then change your CSS to this: .list {background:green;} ul.gallery