On Jul 25, 12:41 am, Mitchell Waite [EMAIL PROTECTED] wrote:
I know this is trivial but what it turned out I needed was something this
simple
jQuery.fn.toggleVis = function() {
if(chesireCat.style.visibility == 'hidden') {
chesireCat.style.visibility = 'visible';
jQuery.fn.toggleVis = function() {
if(this.style.visibility == 'hidden') {
this.style.visibility = 'visible';
} else {
this.style.visibility = 'hidden';
}
};
doesn't this here refer to the jquery object... I don't think jquery
object has a style
Ganeshji,
Correct, As Aaron states above, 'this' refers to the jQuery object, hence
this code will not work.
Mitch,
As I can see it I think you're misunderstanding how jQuery works from the
outside at quite a fundamental level. Did you run through the tutorials at
Take a look at the code examples and tell me if I am missing something here.
Mitch
-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Stephan Beal
Sent: Tuesday, July 24, 2007 11:31 PM
To: jQuery (English)
Subject: [jQuery] Re: Toggling an objects
an objects visiblty without show and hide
Ganeshji,
Correct, As Aaron states above, 'this' refers to the jQuery object, hence
this code will not work.
Mitch,
As I can see it I think you're misunderstanding how jQuery works from the
outside at quite a fundamental level. Did you run through the tutorials
] On
Behalf Of Stephan Beal
Sent: Tuesday, July 24, 2007 11:31 PM
To: jQuery (English)
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
On Jul 25, 12:41 am, Mitchell Waite [EMAIL PROTECTED] wrote:
I know this is trivial but what it turned out I needed was something
this
simple
*From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Rob Desbois
*Sent:* Wednesday, July 25, 2007 2:14 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: Toggling an objects visiblty without show and hide
Ganeshji,
Correct, As Aaron states above, 'this' refers
Rob, I think you left out the return statement that you meant to put in. :-)
(Outstanding explanation, BTW!)
For clarity, it could be:
jQuery.fn.toggleVis = function() {
this.each(function() {
if (this.style.visibility == 'hidden') {
this.style.visibility =
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
It would have been far better if each passed the DOM element as
an argument to the inner function, instead of using this:
It does pass the element, so if you prefer you could write code like:
$('.stuff').each(function(index, element) {
element.style.visibility = 'hidden';
});
Personally,
:-) Mike, I just reread your email and see that you pointed this out
already! Sorry!
Mike
On 7/25/07, Mike Alsup [EMAIL PROTECTED] wrote:
It would have been far better if each passed the DOM element as
an argument to the inner function, instead of using this:
It does pass the element,
Michael Geary wrote:
Rob, I think you left out the return statement that you meant to put in. :-)
(Outstanding explanation, BTW!)
For clarity, it could be:
jQuery.fn.toggleVis = function() {
this.each(function() {
if (this.style.visibility == 'hidden') {
From: Michael Geary
The use of this inside an each loop is one of the two
major design errors in jQuery (the other being the event
system, which I'll get to another day).
Just to avoid any possible misunderstanding, I think everyone knows I
consider jQuery to be a brilliant piece of
is hover not a good solution?
Mitch
-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Geary
Sent: Wednesday, July 25, 2007 10:10 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
Rob, I think you left out the return statement that you meant to put in.
:-)
(Outstanding explanation, BTW!)
For clarity, it could be:
jQuery.fn.toggleVis = function() {
this.each
, July 25, 2007 5:17 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
The hover method takes two functions. One for the mouseover and one for the
mouseout. Here are the docs for the hover method:
http://jquery.bassistance.de/api-browser
] On
Behalf Of Mitchell Waite
Sent: Wednesday, July 25, 2007 7:34 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
Ok here is the skinny (I think I am getting this down)
http://www.whatbird.com/wwwroot/3statebutton_3.html (uses layers
Ha, you beat me by this much, Karl. Plus yours works, whereas mine
is missing a dollar sign right before document ready :(
Joel.
On 26/07/2007, at 2:36 PM, Karl Swedberg wrote:
I didn't make it simpler, really, but I did optimize it a bit.
--Karl
_
Karl Swedberg
@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
PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and
hide
Ok here is the skinny (I think I am getting this down)
http://www.whatbird.com/wwwroot/3statebutton_3.html (uses layers)
$(document).ready(function(){
$(#showPic
On 26/07/2007, at 1:42 PM, Mitchell Waite wrote:
I defy anyone to make this simpler (and work as well)!
This may or may not look simpler, but its more optimised and more
maintainable :)
(document).ready(function(){
var myClass = hidden,
For information, the reason that works is that setting {visibility:hidden}
hides the element but the element's box still affects layout.
Setting {display:none} suppresses box generation altogether.
(From http://www.w3.org/TR/REC-CSS2/visufx.html#visibility)
--rob
On 7/24/07, Aaron Heimlich
';
}
};
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Heimlich
Sent: Monday, July 23, 2007 6:01 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
jQuery.fn.toggleVis = function() {
// Here, this is the jQuery
On 7/24/07, Mitchell Waite [EMAIL PROTECTED] wrote:
What does hit mean
A jQuery object is an pseudo-array[1] that contains all of the HTML elements
selected by a give selector. So
$(div.foo);
is a pseudo-array of all of the div elements on the page that have the
class foo. By hit, I mean
to toggle the
visibility a function in jQuery.
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Heimlich
Sent: Tuesday, July 24, 2007 10:40 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
On 7/24/07
Well you should have mentioned that in the beginning. But, that doesn't mean
that my plugin isn't usable.
On 7/24/07, Mitchell Waite [EMAIL PROTECTED] wrote:
I have a link called 'Change the cats visibility'. I have a div with a cat
image inside it. I would like that particular link to change
@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mitchell Waite
Sent: Tuesday, July 24, 2007 11:08 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
I don't think you understand my question.
I have a link called 'Change the cats
: Tuesday, July 24, 2007 12:45 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Toggling an objects visiblty without show and hide
My apology for the confusion. I should have just posted the darn code. I'll
remember this in the future.
I had one typo, left out the # for the container
On 7/24/07, Mitchell Waite [EMAIL PROTECTED] wrote:
jQuery.fn.toggleVis = function() {
if(chesireCat.style.visibility == 'hidden') {
chesireCat.style.visibility = 'visible';
} else {
chesireCat.style.visibility = 'hidden';
}
};
That works
29 matches
Mail list logo