Gosh the author speaks!
Karl Having authored about 25 computer books on programming and published about 200 (www.mitchwaite.com), I find Learning jQuery a real treasure. The way you guys tell the store is very well thought out, and shows an immense understanding of the person coming to jQuery. You go out of your way to help understand what makes it so different. I just hit chapter 4 page 67 were you introduce css positioning so I can being to see the use of styles better. The link on page 67 is broken. Is there source code for the examples anywhere. It would be so helpful to be able to run each example and modify it. My only quibble and this is more the publisher in me, is that the book suffers on the illustration end. I think there are a lot of places where a drawing or two would have hammered the idea home. I am really enjoying myself. From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Wednesday, July 25, 2007 10:15 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Toggling an objects visiblty without show and hide On Jul 25, 2007, at 12:26 PM, Rob Desbois wrote: I see now that an object in jQuery does not have a visibility directly, it needs a class assigned to it, so that is why example 2 doesn't work. Not entirely sure what you mean by this..? Well, the main point is that the jQuery object is not the same as a DOM element. It doesn't necessarily need a class assigned to it to change the visibility, but that's the approach we took in the early chapters of the book to demonstrate basic jQuery components: $('someSelector').addClass('class') and $('someSelector').removeClass('class') jQuery has its own method to access and modify CSS properties: .css(). So, $('#myDiv').css('visibility') would return the same value as document.getElementById('myDiv').style.visibility Except, I think, .css('visibility') will return "visible" if the element is visible, even if its style attribute isn't explicitly set to "visiblity: visible" whereas the .style.visibility will return "visible" only if that's what the element's style attribute says. I hope I'm not clouding the issue here. Ideally, modifying presentation based on class as its defined in a stylesheet is the way to go. But, Mitchell, I think you'll see later in the book (chapter 5?) that there are times when it's necessary to calculate a css value in your script, so .css() works great for those occasions. --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com