using jquery - onmouseout event

G

Gina

Hello.

I'd like to use the function below to show an explanatory text to pictures.
so far ... in order to hide the text I have to click the image.

instead I would like the onmouseout event for the hiding.

tia Gina

$(document).ready(function() {
$("img").filter(".small").hover(function(){
$("textarea").filter("#imgTitle").show("slow");
return false;
});


$("img").filter(".small").click(function(){
$("textarea").filter("#imgTitle").hide("fast");
return false;
});
});
 
H

Hamish Campbell

Hello.

I'd like to use the function below to show an explanatory text to pictures.
so far ... in order to hide the text I have to click the image.

Read the manual: http://docs.jquery.com/Events/hover#overout

$(document).ready(function() {
$("img").filter(".small").hover(function(){
$("textarea").filter("#imgTitle").show("slow");
return false;
}, function() {
$("textarea").filter("#imgTitle").hide("fast");
return false;
});
));
 
T

Thomas 'PointedEars' Lahn

Hamish said:
Some additional notes:

You're using textareas to show the image title?? That is... unusual.

And a textarea cannot have any child elements either, so isn't

$("#imgTitle").show("slow");

another "optimization" (that single line spawns no less than 1049 calls¹
with jQuery 1.2.6)? I wouldn't use jQuery or scripting for this anyway,
though; see the recent thread about tooltips.
Why?

Finally, this group is more appropriate for jQuery related questions:

http://groups.google.com/group/jquery-en

No, there is only where this cult of incompetence lives.


PointedEars
___________
¹ <http://yuiblog.com/blog/2007/01/26/video-hewitt-firebug/>
 
G

Gina

thanks for the hint :)

reading it before already, I still could not solve my problem
(so I posted the version1)

using the code underneath, the information shows and hides twice ...
well ... what is wrong with it ?

$(document).ready(function() {
$("img").filter(".small").hover(function(){
$("textarea").filter("#imgTitle").show(1000);
},function(){
$("textarea").filter("#imgTitle").hide(400);
});
});



Hello.

I'd like to use the function below to show an explanatory text to
pictures.
so far ... in order to hide the text I have to click the image.

Read the manual: http://docs.jquery.com/Events/hover#overout

$(document).ready(function() {
$("img").filter(".small").hover(function(){
$("textarea").filter("#imgTitle").show("slow");
return false;
}, function() {
$("textarea").filter("#imgTitle").hide("fast");
return false;
});
));
 
H

Hamish Campbell

using the code underneath, the information shows and hides twice ...
well ... what is wrong with it ?

Not sure, try the jQuery group posted above. Including the
corresponding HTML would be useful too.
And a textarea cannot have any child elements either, so isn't
$("#imgTitle").show("slow");
another "optimization"

For Gina's benefit: It's better because it is an ID selector, which
must be unique anyway. 'filter' removes elements from the current
selection, so it doesn't matter that it can't have children. I.e., $
("textarea").filter("#imgTitle") is the slow[er] way of doing $
("textarea#imgTitle'), which *should* also be equivalent to $
("#imgTitle").
No, there is only where this cult of incompetence lives.

Better there than here.
 
D

David Mark

using the code underneath, the information shows and hides twice ...
well ... what is wrong with it ?

Not sure, try the jQuery group posted above. Including the
corresponding HTML would be useful too.
And a textarea cannot have any child elements either, so isn't
  $("#imgTitle").show("slow");
another "optimization"

For Gina's benefit: It's better because it is an ID selector, which
must be unique anyway. 'filter' removes elements from the current
selection, so it doesn't matter that it can't have children. I.e., $
("textarea").filter("#imgTitle") is the slow[er] way of doing $
("textarea#imgTitle'), which *should* also be equivalent to $
("#imgTitle").
No, there is only where this cult of incompetence lives.

Better there than here.

Better in what sense? It's inconceivably stupid to ask a blind man
for directions, even in their own library.

You might get a back-slap from a well-wisher and some random stabs at
answers, but ultimately it is a waste of time. There's far more
useful information about jQuery here than there, including answers to
questions that consistently go unanswered elsewhere.

So don't be stupid.
 
D

David Mark

http://jibbering.com/faq/#onlineResources

   "No javascript libraries are endorsed by this
   group. If you are looking for help using a library,
   visit that library's discussion group instead.

Yeah, we see that every few days under "What Online Resources are
Available."
   jQuery [English]
   http://groups.google.com/group/jquery-en"
So don't be stupid.

Sure, whatever.

No, not whatever. Cold, clear facts can be found here. Complete (and
demonstrable) nonsense can be found there. It's the same every day.

Try reading.
 
H

Hamish Campbell

No, not whatever.

Yes, whatever. I've provided some help to the original question and
supplied a link to further information as suggested by the FAQ. If you
believed that this group was more suitable, you would have provided
answers, instead of insults and needless commentary.

Care to prove it in your inevitable reply?
 
D

David Mark

Yes, whatever. I've provided some help to the original question and
supplied a link to further information as suggested by the FAQ.

The FAQ is full of shit on this one (among other things.) The last
place you should inquire about jQuery is at the cult's headquarters.
The only real answer is to not use it. It's not a matter of taste.
The fucking thing is broken beyond belief and the people who support
it are completely clueless about it. Isn't that all you really need
to know?
If you
believed that this group was more suitable, you would have provided
answers, instead of insults and needless commentary.

That's an odd assumption. I didn't insult you, but perhaps reading is
not your thing. As for "needless commentary", this is not a help
desk.

[snip]
 
P

Peter Michaux

   $("img").filter(".small").hover(function(){

I don't know much about jQuery but isn't it possible to write the
following?

$("img.small").hover(function(){

I thought doing things like this was the whole point of the $()
function.

Peter
 
D

David Mark

I don't know much about jQuery but isn't it possible to write the
following?

     $("img.small").hover(function(){

I thought doing things like this was the whole point of the $()
function.

If it had a point, that would be it. Of course, most of jQuery's
"supported" browsers have that built-in today.

The fact that these scripts create a new jQuery object on virtually
every line is such a ludicrously ham-fisted approach, but I often see
it described as an "evolution" of the "low-level" Javascript
language. It's not programming, but memorization of patterns, which
unfortunately shift in meaning whenever the authors realize they have
hopelessly botched yet another critical function.

Am I the only one wondering why they haven't even *addressed* the
failings of - for example - the attr method? Going on two years now.
And what of the outrageous memory leaks in IE? I see jQuery parrots
chirping about sidestepping browser quirks and "playing nice" with IE
memory leaks all the time. That and the wonderful community and
documentation. Or as our favorite jQuery fanboy recently opined, if a
library is popular, that's a good enough reason to stake your fucking
career on it. Realistically, the community knows nothing about the
script they worship and the documentation is mostly fiction.

Somebody recently mentioned an upcoming "re-factoring" by the master
Ninja. Seems the lights are on, but nobody's home.

I guess "Web designers" are so desensitized to incompetence that it
doesn't natter. To them, none of this stuff works (at least not for
very long), so slap it together, collect a check and find a new victim
(er, I mean client.)
 
H

Hamish Campbell

I guess "Web designers" are so desensitized to incompetence that it
doesn't natter.  To them, none of this stuff works (at least not for
very long), so slap it together, collect a check and find a new victim
(er, I mean client.)

If this group can maintain a veneer of professionalism that the
industry so lacks, I would be interested in a level-headed discussion
about the pros and cons. I fully recognize the expertise in this
group, but the objections vented here are very rarely articulated
clearly or compellingly, and use-cases are usually ignored as
extraneous or irrelevant.
It's not programming, but memorization of patterns

To a degree, absolutely. The same argument applies to a server-side
frameworks, and to a lesser extent, all sorts of software libraries.
This would deny the plain and simple fact that 'saving time' is a
real, tangible & valid reason for abstraction.
 
D

David Mark

If this group can maintain a veneer of professionalism that the
industry so lacks, I would be interested in a level-headed discussion

You want professionalism, you have to pay for it. :)
about the pros and cons. I fully recognize the expertise in this
group, but the objections vented here are very rarely articulated
clearly or compellingly, and use-cases are usually ignored as
extraneous or irrelevant.

Rarely or not, they have been articulated to death (for this script in
particular.) Search the archive for "jQuery" + my name. Print them
out and you've got a book on why jQuery is the stupidest move you
could make. I'm really not saying "don't be stupid" to insult you (or
anyone.) Okay, perhaps John Resig, but to hell with him.
To a degree, absolutely. The same argument applies to a server-side
frameworks, and to a lesser extent, all sorts of software libraries.
This would deny the plain and simple fact that 'saving time' is a
real, tangible & valid reason for abstraction.

But you don't save any time at all with jQuery. You pass the wasted
time on to the users (and eventually your clients.)

http://dante.dojotoolkit.org/taskspeed/report/charts.html

The spin in jQuery-land is that the new version is up to 40% faster.
It's still not a horse race. Even among its peers, it is clearly
bankrupt of efficiency. Personally, I find that very offensive. The
miserable thing bogs down my older PC's running FF3 on pages that do
*nothing* to justify hogging *my* resources. Unobtrusive,
schmunobtrusive.

And you cannot, under any circumstances, write competent cross-browser
scripts by memorizing jQuery patterns. Not a chance. As for server-
side, ASP.NET is jQuery's opposite number. How perfect that they are
now together. Well, not really. If you buy a really expensive tool
from MS, you get a free jQuery script.

And forget accessibility with this bullshit, too. It's a lose-lose-
lose situation (you, your clients and their users.) The exception
would be crooks and the hopelessly deluded.
 
D

David Mark

That is unfortunate since the courtesy of civil behavior is free to
give.

Indeed. I give it to everybody that I choose to answer. Most would
be much worse off if I didn't answer. Yet, many translate "you are
doing something foolish" (or whatever) to an insult. It's childish
and irritating and often brings the discussion to a grinding halt
(i.e. they reply with counter-flames instead of more questions.)

Granted, others are a bit less civil, but to each his own. :)
 
M

Matt Kruse

That is unfortunate since the courtesy of civil behavior is free to
give.

Peter, it's so nice to read your posts when you chime in. The fact
that you are both generous with sharing your knowledge/experience and
also considerate and patient of those who are still learning speaks
highly of you as a person and also adds to your credibility. Your
approach is appreciated.

Matt Kruse
 
D

David Mark

Peter, it's so nice to read your posts when you chime in. The fact
that you are both generous with sharing your knowledge/experience and
also considerate and patient of those who are still learning speaks
highly of you as a person and also adds to your credibility. Your
approach is appreciated.

Why not send him an email? Oh, because you want attention. Your self-
serving Spam is not appreciated (as usual.) Please go back to the
farm team until you have something useful to say about browser
scripting. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top