Re: [jQuery] highlight/fade the current table row

2007-03-30 Thread Karl Swedberg

Hi Bruce,

Adam's solution was very close, but you'll need an s on the end of  
parent.


$(this).parents('tr').highlightFade...

Also, if you have nested tables for some reason, you can put  
the :first pseudo-class on the tr, like so:


$(this).parents('tr:first').highlightFade...

Let me know if that doesn't work for you.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 30, 2007, at 8:09 AM, Bruce MacKay wrote:


Thanks Adam,

That's certainly closer, but it's not quite there - at least on my  
page.


$(this).parent('tr').highlightFade doesn't fire.

On the other hand, $(this).parent('td').highlightFade... does fire  
on the td within which the checkbox sits.


Sorry, but I'm unsure how to go one step further back to finger the  
parent tr of the current td.


Cheers/Bruce

At 11:54 p.m. 30/03/2007, you wrote:

Hi!
 I'm after some assistance (syntax I guess) on how one selects the
 current row of a table.

 The context of this query is that I have a table of data in  
which the
 last column of each row contains a checkbox which the user  
checks if

 the data case is to be deleted.

 When checked, I want the row to be highlighted/fade as a visual  
check

 for the user that they have checked (for deletion) the row of data
 they intended.
 My code thus far is:

 $('[EMAIL PROTECTED]').click(function() {
 $(select-the-current-tr).highlightFade({color:'yellow',speed: 
2000,iterator:'sinusoidal'});});



 What should go in the select-the-current_tr section?
this).parent('tr'

this will apply the highlightFade method on the input's tr parent.

Cheers,
Adam

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] highlight/fade the current table row - solution

2007-03-30 Thread Karl Swedberg
On Mar 30, 2007, at 8:40 AM, Brunner Adam wrote:
 Hi!
 $(this).parent('td').parent('tr').highlightFade(...

 Is there shorthand syntax for .parent('td').parent('tr')?
 Sorry, made a typo. So this is the solution for you:

 $(this).parents('tr').highlightFade(...

 Cheers,
 Adam

argh! Sorry, I didn't see this email before sending mine. My dumb  
email app didn't thread the messages right, again.

Adam's solution above should work just fine for most situations.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Any regular expression gurus here?

2007-03-29 Thread Karl Swedberg


On Mar 29, 2007, at 4:55 AM, Christof Donat wrote:

Regular Expressions are used to define regular (Type 3 in Chomsky  
Hirarchy)
grammars. You can not express nested parentheses in regular  
grammar, you need

a context free (Type 2) but not regular grammar.


Christof, that is fascinating! Thanks for that information!


This is something I'll have to remember for the next dinner  
conversation with friends. You never know where Noam Chomsky[1] might  
pop up in a conversation. :)


--Karl

[1] http://en.wikipedia.org/wiki/Chomsky
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] bug found

2007-03-29 Thread Karl Swedberg
this might not actually be a bug. I have a hunch that it has to do  
with your use of .insertAfter()


.insertAfter() will insert the elements one at a time in the correct  
order, but since each one is being inserted immediately after the h2,  
each is appearing before the previous one.


I'm probably not explaining this well, so I'll just say that you will  
have more success using .appendTo(). Depending on how your DOM is  
structured, you might want to first create a container div after the  
h2 and then append your $(html) to that.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 29, 2007, at 9:17 AM, Michel Brouckaert wrote:

this is a bug I found when using firebug to refresh some data in an  
menu..

code:
			$.post(rAction,{action:login,ddd:$(#ccc).val(),ddd:$ 
(#ddd).val()},function(html){

$(html).insertAfter($(div#compte .padder 
fieldset
h2)).load(errorVerif2());
activeMenu();
$.load(errorVerif2());
});
instead of returning
p1/p
p2/p
p3/p
ul
 li1/li
 li2/li
 li3/li
/ul

it returned the following


ul
 li1/li
 li2/li
 li3/li
/ul
p3/p
p2/p
p1/p

the reversion of the elements only seems to happen on the top level
elements of the html answer.
But it seems rather disturbing.

thx for reading this.
Michel Brouckaert

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Collapsing table Columns?

2007-03-29 Thread Karl Swedberg

If it's the third column, you could also try this:

$('td:nth-child(3)').hide()

If you have ths in your table and need to hide them, too, you can  
do this:

$('td:nth-child(3), th:nth-child(3)').hide()

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 29, 2007, at 12:36 PM, Alexandre Plennevaux wrote:


Using the col element maybe?

Otherwise, if it is the 3rd column you could do this:

$(td+td+td).hide();

I dunno if that works, but it's the css way to address the 3rd column.

-Original Message-
From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On

Behalf Of Baxter
Sent: jeudi 29 mars 2007 16:28
To: discuss@jquery.com
Subject: [jQuery] Collapsing table Columns?

Any ideas how one could hide/show table columns, rather than rows?


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

--
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.448 / Base de données virus: 268.18.20/737 - Date:  
28/03/2007

16:23



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Binding to multiple items with one call

2007-03-29 Thread Karl Swedberg

I think you just have a couple extra single-quotes in there:


$j('#person', '#assigned').blur(function() { sendok=true;
alert(sendok);} );


the selector here is trying to get the #person element within the  
context of the #assigned  element. if you want to get both, you need  
to enclose them in the same set of quotation marks like this:


   $j('#person, #assigned').blur(function() { sendok=true;
  alert(sendok);} );



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 29, 2007, at 12:22 PM, Shelane Enos wrote:


This doesn't seem to be working:
bindBlur = function(){
$j('#person', '#assigned').blur(function() { sendok=true;
alert(sendok);} );
}

But this does:

bindBlur = function(){
$j('#person').blur(function() { sendok=true; alert 
(sendok);} );

}


Do I have to do them all individually or am I just putting those  
IDs in

incorrectly?


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Collapsing table Columns?

2007-03-29 Thread Karl Swedberg

On Mar 29, 2007, at 1:40 PM, Richard Thomas wrote:

You would need to hide every cell in the row


I don't know what you're getting at here. If you mean every cell in  
the *column*, then that is exactly what 'td:nth-child(n)' would get.  
But maybe I'm misunderstanding you.



also I don't know if its
fixed in jQuery but IE and Firefox differ in how to unhide the cell,
one requires being set to block mode the other to table-cell or
something, don't remember off the top of my head.


This is only an issue with the animated show and hide methods. Just  
using .show() and .hide() isn't a problem.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Collapsing table Columns?

2007-03-29 Thread Karl Swedberg

Hey, no problem, Richard. I hope I didn't seem too abrupt with my reply.

By the way, :nth-child() is actually a CSS3 (pseudo-class) selector:

http://www.w3.org/TR/css3-selectors/#nth-child-pseudo

it'll be really cool when browsers start supporting these. In the  
meantime, we have jQuery. :)

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 29, 2007, at 2:52 PM, Richard Thomas wrote:


Sorry I don't know the xpath/selectors that well yet.

I had problems with just the show and hide in the past, so I had to
use custom code like the following

toggleClasstr = 'block'
// Supports DOM2 requires specific style
if ( window.addEventListener != undefined ) {
   toggleClasstr = 'table-row';
}

Looks like this was fixed in jquery which is nice I can get rid of my
extra code.

On 3/29/07, Karl Swedberg [EMAIL PROTECTED] wrote:

On Mar 29, 2007, at 1:40 PM, Richard Thomas wrote:
You would need to hide every cell in the row

 I don't know what you're getting at here. If you mean every cell  
in the
*column*, then that is exactly what 'td:nth-child(n)' would get.  
But maybe

I'm misunderstanding you.


also I don't know if its
fixed in jQuery but IE and Firefox differ in how to unhide the cell,
one requires being set to block mode the other to table-cell or
something, don't remember off the top of my head.

This is only an issue with the animated show and hide methods.  
Just using

.show() and .hide() isn't a problem.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Selector question

2007-03-28 Thread Karl Swedberg

You might also be able to reduce this a bit, depending on your markup:

$('a.selected').parents('div.linkSubMenu').show();

It seems a shame to traverse all the way down that set of nodes, only  
to have to traverse back up.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 28, 2007, at 5:06 PM, Alexandre Plennevaux wrote:


in fact i just found a way:

$(div.linkSubMenu ul li a.selected).parent().parent().parent 
().show();


is that the correct way? It seems a bit slow on rendering it.

From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux

Sent: mercredi 28 mars 2007 21:31
To: 'jQuery Discussion'
Subject: [jQuery] Selector question

hello !

i have a menu which structure for each item is:
(1)  ul  li  div.linkSubMenu  ul.detailSubnavlia

except for the selected menu, which is:

(2)  ul  li  div.linkSubMenu  ul.detailSubnavlia.selected


on load, all div.linkSubMenu are hidden (via css: display:none)

i would like that the selected one (2) be shown. I don't know how  
to target it via jquery, can you help me out?


thank you!

alex



Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte
Lakensestraat/Rue de Laeken 104
B-1000 Brussel-Bruxelles-Brussels
Belgie-Belgique-Belgium

Tel:+32(0)2.219.65.55
Fax:+32(0)2.426.69.86
Mobile:+32(0)476.23.21.42
http://www.lab-au.com
http://www.mediaruimte.be

__ 



The information in this e-mail is intended only for the addressee  
named above.  If you are not that addressee, please note that any  
disclosure, distribution or copying of this e-mail is prohibited.
Because e-mail can be electronically altered, the integrity of this  
communication cannot be guaranteed.


__ 





--
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date:  
27/03/2007 16:38



--
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date:  
27/03/2007 16:38


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] JQuery vs prototype

2007-03-27 Thread Karl Swedberg

On Mar 27, 2007, at 10:47 AM, Matt Kruse wrote:

3) Prototype is tied closely to the Ruby on Rails community. If you  
use Ruby on
Rails, definitely choose Prototype. Outside of that community I see  
no reason
to choose Prototype over other frameworks like jQuery or even Moo.  
If you must
have a class-based design, look at Moo. If you like readable code,  
look at

jQuery.



Yehuda Katz has been using jQuery with Rails pretty extensively over  
the past few months, so it would be interesting to get his take on  
this as well.


He also has been working on a jQuery for Rails plugin that should  
help Rails developers transition to jQuery quite easily.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Learning jQuery, the Book

2007-03-26 Thread Karl Swedberg
On Mar 26, 2007, at 4:17 AM, agent2026 wrote:


 Hi Karl,

 Could you provide links to these posts?  Haven't read them myself,  
 and I
 can't seem to find them.

 Adam



 Karl Swedberg-2 wrote:

 In fact, if you read the post to this list about AJAX and Events:
 Handling the Handlers and Scoping an Event Binding Function,  then
 you've already read part of the book (well, part of the first  
 draft, at
 least).


Sure thing, Adam.

Actually, it's easier for me to simply re-post, so here you go:

--Karl


---

In the near future there will be a dead-tree reference for jQuery on
the shelves. A short excerpt from the first draft should prove
applicable to this conversation:

---

AJAX and Events: Handling the Handlers

Suppose we wanted to highlight all the h3 elements on the page when
they are clicked. By now the code to perform such a task is almost
second-nature:

$(document).ready(function() {
$('h3').click(function() {
  $(this).toggleClass('highlighted');
});
});

All is well, in that clicking on the letters on the left side of the
page highlights them. But the dictionary terms are also h3
elements, and they do not get the highlight. Why?
The dictionary terms are not yet part of the DOM when the page is
loaded, so the event handlers are never bound. This is an example of
a general issue with event handlers and AJAX calls: loaded elements
must have all of their event handlers rebound.

A first pass at solving this problem is to factor the binding out
into a function, and call that function both at the time the document
is ready and after the AJAX call:

$(document).ready(function() {
var bindBehaviors = function() {
  $('h3').click(function() {
$(this).toggleClass('highlighted');
  });
}

bindBehaviors();

$('#letter-a .button').click(function() {
  $('#dictionary').hide().load('a.html', function() {
bindBehaviors();
$(this).fadeIn();
  });
});
});

Now we can put all our event handlers in the bindBehaviors()
function, and call that whenever the DOM changes. Clicking on a
dictionary term now highlights it, as we intended. Unfortunately,
we've also managed to cause very strange behavior when the letters
are clicked. At first they highlight correctly, but after the button
is clicked (loading the dictionary entries), they no longer highlight
on subsequent clicks.

Closer inspection reveals that, after the AJAX call, the highlighting
breaks because the click handler is fired twice. A
doubled .toggleClass() is the same as none at all, so the click seems
not to work. A tricky behavior to debug, to be sure. The culprit here
is bindBehaviors(), which binds the click event to all h3 elements
each time. After a button click, there are actually two event
handlers for clicks on an h3, which happen to do the exact same thing.

Scoping an Event Binding Function

A nice way around this double-firing is to pass some context into
bindBehaviors() each time we call it. the $() constructor can take a
second argument, a DOM node to which the search is restricted. By
using this feature in bindBehaviors(), we can avoid multiple event
bindings:

$(document).ready(function() {
var bindBehaviors = function(scope) {
  $('h3', scope).click(function() {
$(this).toggleClass('highlighted');
  });
}

bindBehaviors(this);

$('#letter-a .button').click(function() {
  $('#dictionary').hide().load('a.html', function() {
bindBehaviors(this);
$(this).fadeIn();
  });
});
});

The first time bindBehaviors() is called, the scope is document, so
all h3 elements in the document are matched and have the click
event bound. After an AJAX load, though, the scope is instead the
div id=dictionary element, so the letters are not matched and are
left alone.

Using Event Bubbling

Adding scope to a behavior-binding function is often a very elegant
solution to the problem of binding event handlers after an AJAX load.
We can often avoid the issue entirely, however, by exploiting event
bubbling. We can bind the handler not to the elements that are
loaded, but to a common ancestor element:

$(document).ready(function() {
$('body').click(function(e) {
  if ($(e.target).is('h3')) {
$(e.target).toggleClass('highlighted');
  }
});
});

Here we bind the click event handler to the body element. Because
this is not in the portion of the document that is changed when the
AJAX call is made, the event handler never has to be re-bound.
However, the event context is now wrong, so we compensate for this by
checking what the event's target attribute is. If the target is of
the right type, we perform our normal action; otherwise, we do nothing.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] utf-8 and jquery

2007-03-26 Thread Karl Swedberg

Calling Jake! Calling Ⓙⓐⓚⓔ! Come in, ʝǡǩȩ.

ᎫᎪᏦᎬ, someone needs your help.

:-)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 26, 2007, at 8:34 AM, amircx wrote:



my db and the page saved as utf-8...

its returns me in textfield values of : ×××

and wierd chars
instad of hebrew letters

Michael Fuerst wrote:




hey. when im trying to send data to mysql or anything else in forgin
language
such hebrew its retruns me gibbrish... its a known bug?
how can i fix it? i need to use php htmlentitles() ?




I would say this debends what you mean with its retruns me  
gibbrish:


The data you get back from your ajax-call is probably utf-8  
encoded. But
is the data in your database also utf-8 encoded? If not, your're  
inserting
non utf-8 code into an utf-8 encoded document... a php utf8_encode  
when
inserting the data from database into your ajax-result would do  
the trick

in that case...

michael


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
View this message in context: http://www.nabble.com/utf-8-and- 
jquery-tf3466629.html#a9672408

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Book?

2007-03-26 Thread Karl Swedberg

Hi Jack,

Your timing is impeccable! :)

Posted just this morning:
http://jquery.com/blog/2007/03/26/jquery-book-coming-soon/
http://www.learningjquery.com/2007/03/learning-jquery-the-book

I promise I will provide more details about what's inside as soon as  
the publisher gives me the green light.


Also, about the publication date. Right now all I can say is this  
summer. But this should start firming up soon, too, and I'll report  
more when I know more.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 26, 2007, at 9:20 AM, Jack Gleeson wrote:

Just wondering if anyone has any information on the 'jQuery Book'  
rumours,


Any idea's whats inside and when its due, cheers


--
--

Jack Gleeson
Web Developer

www.jackgleeson.co.uk
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How can I get a second children element?

2007-03-26 Thread Karl Swedberg
Ah yes, of course.  I'm glad you figured it out! I think part of the  
problem with our solutions was that we didn't see your actual markup.


For future reference:

	$('E:nth-child(n)') will select an E element that is the nth child  
of its parent element.
	$('E').children().get(n) will select an element that is the (n+1)th  
child of the E element.


You should also be able to use .eq(n) if you want to keep the chain  
going (returns the jQuery object rather than the DOM element):


$('E').children().eq(n)

Or you could do this:

$('E').children(':eq(n)')

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 26, 2007, at 8:28 AM, MARIO MOURA wrote:


Thanks Karl

I tried but didnt work (I made a lot of variations)


but this is working fine:
$(#imagefields).append( $(.group-image).children().get(3) );

Thanks for help

Regards

Mario

2007/3/24, Karl Swedberg [EMAIL PROTECTED]:

$(#imagefields).append( $(.group-image:nth-child(2)) );

Hi Mario, I know you were referring to the other Karl below, but if  
you don't mind, I'll jump in with an answer (I posted another  
response to your original post, because my email program didn't  
have it threaded with the the replies and I thought nobody had  
answered yet).


You're almost there. You just need to put the quotation marks  
around the pseudo-class as well. So, this should work:

  $(#imagefields).append( $(.group-image:nth-child(2)) );



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 24, 2007, at 6:03 AM, MARIO MOURA wrote:


Evan

Thanks a lot your solution works for me.

My real example is:
$(#imagefields).append( $(.group-image).children().get(2) );

But I am curious about what Karl said I tried a lot of things but  
I believe I have a error syntax.


$(#imagefields).append( $(.group-image:2-child(n)) );
or I tried too
$(#imagefields).append( $(.group-image:nth-child(2)) );

What is wrong?
Regards

macm

2007/3/24, Evan [EMAIL PROTECTED] :
You could also use get(), though it's probably slower

$('div').children().get(1);

On Mar 24, 3:04 pm, Karl Rudd [EMAIL PROTECTED] wrote:
 Have read of this page:

http://docs.jquery.com/Selectors#CSS_Selectors

 Especially E:nth-child(n)

 Karl Rudd

 On 3/24/07, MARIO MOURA [EMAIL PROTECTED] wrote:



  Hi

  I am newbie

  How can I get a second children element?

  In firebug I have

  ---DIV
  --FIELD
  --FIELD
  --FIELD
  --FIELD
  --FIELD

  My problem is all children have same name. How can I get  
second and after

  the third...

  Regards

  --
  macm
  ___
  jQuery mailing list
  [EMAIL PROTECTED]
 http://jquery.com/discuss/

 ___
 jQuery mailing list
 [EMAIL PROTECTED]://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



--
Mário Alberto Chaves Moura
[EMAIL PROTECTED]
31-9157-6000
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
Mário Alberto Chaves Moura
[EMAIL PROTECTED]
31-9157-6000
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Learning jQuery, the Book

2007-03-25 Thread Karl Swedberg

Karl Swedberg schrieb:

When that jQuery book comes out, I hear it's going to have an awesome
Appendix dealing with closures. ;-)

No way!!

--  
Jörn Zaefferer


Yep, it's true, Jörn! Jonathan Chaffer wrote it. I read it. Then I  
said, Wow, that's an awesome Appendix dealing with closures! And I  
heard myself say it. ;-)


Hello all,

I'll be posting an entry on the jQuery and Learning jQuery blogs  
tomorrow morning, but I wanted you to hear it first: Jonathan Chaffer  
and I have been writing a book on jQuery. In fact, if you read the  
post to this list about AJAX and Events: Handling the Handlers and  
Scoping an Event Binding Function,  then you've already read part  
of the book (well, part of the first draft, at least).


I've been keeping my mouth shut about this for months now, so I am  
very relieved to be able to announce the book at last.


Here is the blog entry...

***
For those of you who have been following the jQuery blog the past  
couple months, you may have noticed John Resig’s mention of a secret:  
“There’s a jQuery book in the works!” Well, I am thrilled to be able  
to leak a little more information about that secret.


For the past few months my friend Jonathan Chaffer and I have been  
hard at work on the book, and everything is progressing well. Our  
writing is being supported by a stellar group of technical reviewers,  
some of who are members of the jQuery development team. We’ll be able  
to divulge details about the book’s contents soon. The publisher is  
readying a web page for it, so as soon as that is completed, we can  
give you the full scoop.


About the Authors

Jonathan Chaffer is a long-time Drupal contributor and creator of  
Drupal’s CCK. He also likes to make up bizarre band names and album  
titles, based on snippets of conversations he overhears, at Tweak the  
Viking (www.tweaktheviking.com). Karl Swedberg (that’s me) is a  
jQuery zealot who runs the Learning jQuery blog and still tries to  
keep a bit of his former career as an English teacher alive at his  
other blog, English Rules (www.englishrules.com). Jonathan and Karl  
work together at Structure Interactive in Grand Rapids, Michigan,  
where they have been given a lot of freedom to use jQuery, as well as  
standards-based, semantic HTML  CSS, in many of their projects.


***

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How can I get a second children element?

2007-03-24 Thread Karl Swedberg

Hi Mario,

To get the second child, you can use the :nth-child(n) pseudo-class:

  $('FIELD:nth-child(2)')

If you want all of the fields after the third, you can use :gt(n)
  $('FIELD:gt(2)')

More fun ways to select elements can be found in the docs:
  http://docs.jquery.com/DOM/Traversing

Also, I wrote a couple entries on learningjquery.com that might help:
  http://www.learningjquery.com/2006/11/how-to-get-anything-you-want- 
part-1
  http://www.learningjquery.com/2006/12/how-to-get-anything-you-want- 
part-2


Hope that helps.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 23, 2007, at 9:14 AM, MARIO MOURA wrote:


Hi

I am newbie

How can I get a second children element?

In firebug I have

---DIV
--FIELD
--FIELD
--FIELD
--FIELD
--FIELD

My problem is all children have same name. How can I get second and  
after the third...


Regards

--
macm
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How can I get a second children element?

2007-03-24 Thread Karl Swedberg

$(#imagefields).append( $(.group-image:nth-child(2)) );

Hi Mario, I know you were referring to the other Karl below, but if  
you don't mind, I'll jump in with an answer (I posted another  
response to your original post, because my email program didn't have  
it threaded with the the replies and I thought nobody had answered yet).


You're almost there. You just need to put the quotation marks around  
the pseudo-class as well. So, this should work:

  $(#imagefields).append( $(.group-image:nth-child(2)) );



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 24, 2007, at 6:03 AM, MARIO MOURA wrote:


Evan

Thanks a lot your solution works for me.

My real example is:
$(#imagefields).append( $(.group-image).children().get(2) );

But I am curious about what Karl said I tried a lot of things but I  
believe I have a error syntax.


$(#imagefields).append( $(.group-image:2-child(n)) );
or I tried too
$(#imagefields).append( $(.group-image:nth-child(2)) );

What is wrong?
Regards

macm

2007/3/24, Evan [EMAIL PROTECTED]:
You could also use get(), though it's probably slower

$('div').children().get(1);

On Mar 24, 3:04 pm, Karl Rudd [EMAIL PROTECTED] wrote:
 Have read of this page:

http://docs.jquery.com/Selectors#CSS_Selectors

 Especially E:nth-child(n)

 Karl Rudd

 On 3/24/07, MARIO MOURA [EMAIL PROTECTED] wrote:



  Hi

  I am newbie

  How can I get a second children element?

  In firebug I have

  ---DIV
  --FIELD
  --FIELD
  --FIELD
  --FIELD
  --FIELD

  My problem is all children have same name. How can I get second  
and after

  the third...

  Regards

  --
  macm
  ___
  jQuery mailing list
  [EMAIL PROTECTED]
 http://jquery.com/discuss/

 ___
 jQuery mailing list
 [EMAIL PROTECTED]://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



--
Mário Alberto Chaves Moura
[EMAIL PROTECTED]
31-9157-6000
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Plugin Requests

2007-03-23 Thread Karl Swedberg
Yeah, Glen is the one who wrote that. It's not in plugin form,  
though. I think that's the part that Glen was saying he didn't know  
how to do.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 23, 2007, at 2:04 AM, Allan Mullan wrote:


Ummm the slots one is already jQuery - The JS is in this file:
http://commadot.com/jquery/slots/includes/indexNoProduct.js

Pretty damn cool actually

Allan


Glen Lipka wrote:


On 3/22/07, *Sean Catchpole * [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:

Post your plugin requests.


I thought this would have made an interesting  plugin, but I didnt
know how to do it.
http://commadot.com/jquery/slots/ http://commadot.com/jquery/slots/

Also, Karl wrote this:
http://www.learningjquery.com/2006/10/scroll-up-headline-reader
But I thought it deserved to be a plugin with more interface to it.
Like Scroll speed,  Pause Speed, etc.  Maybe different effects to do
transitions.

I hope these meet the challenge. :)  Thanks for volunteering, its  
awesome!


Glen


- 
---


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Best way to find current position in DOM stack?

2007-03-23 Thread Karl Swedberg

Hi Nate,

Give this one a shot:

$('li').each(function(index){
  if($(this).is('.selected')) {
alert(index+1);
  };
});



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 23, 2007, at 1:41 PM, Nate Cavanaugh wrote:



Hi all,
I'm looking to find the current numeric position of a certain element
amongst it's siblings.

Let's say I have a list like so:

ul
liTest 1/li
liTest 2/li
li class=selectedTest 3/li
liTest 4/li
liTest 5/li
/ul

So, I grab $('li.selected'). I now want to find out what number it  
is (in

this case, I would want it to return 3).

Currently, I am doing it this way, but I am hoping for a more  
jQuery-esque

way:

var item = $('li.selected')[0];
var position = 1;
$('li').each(function() {
if(this != item){
position++;
}else {
return false;
}
});

Seems a bit ugly, but it could be the only way, I dunno.

Anyone have any thoughts?
--
View this message in context: http://www.nabble.com/Best-way-to- 
find-current-position-in-DOM-stack--tf3455334.html#a9639907

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Gurus - best Javascript references?

2007-03-23 Thread Karl Swedberg
When that jQuery book comes out, I hear it's going to have an awesome  
Appendix dealing with closures. ;-)



--Karl

p.s. Look for more book details coming soon (hint, hint)

_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 23, 2007, at 1:22 PM, Nathan Young -X (natyoung - Artizen at  
Cisco) wrote:



Hi.

I hope I'm not stepping into the role of guru by replying to this
message!!

Here's a great article on closures, references, scope, etc:

http://jibbering.com/faq/faq_notes/closures.html

--N



.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._ 
.:

||:.

Nathan Young
Cisco.com-Interface Development
A: ncy1717
E: [EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Daemach
Sent: Friday, March 23, 2007 10:16 AM
To: jQuery Discussion.
Subject: [jQuery] Gurus - best Javascript references?

I have no formal programming training, so I often brute-force
things that could be a lot more elegant.  One thing I'm
struggling with in particular now is the benefits of creating
object prototypes over just storing data in a global tree.  A
few people on this list have taken a shot at explaining some
of this to me, and thank you very much for that, but it's
just not sinking in which is unusual and frustrating.

Can you all tell us what books are good for advanced
Javascript reference?  Closures, objects, advanced functions,
etc.  I've been doing DOM programming long enough that I can
find a way around pretty much every problem but I want to
take my game to the next level.

Your help is much appreciated!!




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] animating off screen

2007-03-20 Thread Karl Swedberg


On Mar 20, 2007, at 1:14 PM, Robert O'Rourke wrote:

 [EMAIL PROTECTED] wrote:
 Hi,

 Yesterday I got some great help on how to animate a DIV and move  
 it from offscreen left to the middle of the screen.  My question  
 now is I want to slide that div to off-screen right.  The  
 complication is that I don't know how big the user's browser is  
 going to be.  How can I slide the div completely off screen to the  
 right?

 Thanks, - Dave



 The user's browser width should always be 100%. Kind of a CSS  
 variable.
 Perhaps use jQuery to get that value and then shove the div off by  
 50%.
 One thing you want to watch out for is converting things to pixel
 dimensions so if I maximise my screen after the div has disappeared  
 off
 the side I mightbe able to see it again. Use % to offset the div  
 and you
 should be fine.

 Rob

Just to be safe, you might want to hide the div after you've animated  
it out of the viewable area.
Putting $(this).hide() in the callback of .animate() should do the  
trick.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] slideDown/slideUp problems when using tables

2007-03-18 Thread Karl Swedberg

Hi Kush,

If you are smoking crack, you're surprisingly lucid, because I've  
noticed the same issues. :)


Like you, I threw in the .show() to get the .fadeIn() to work in FF,  
but we shouldn't have to do that. Also, I hadn't tested in IE, but  
now I see that table rows hide and show without animation whether we  
use fade in/out or slide down/up.


I'll try to submit a bug report later today.

Thanks a lot for noting those things!


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 17, 2007, at 9:51 PM, Kush Murod wrote:


Hi Karl,
Thanks for your help dude
There are few things though.
in FF it fades in/out, but it had to manually show() it [.fadeIn 
('slow').show();] otherwise wasn't fadeIn, is it supposed to that way
in IE doesn't fade in/out is this a limitation or is it just me  
smoking crack :)

http://www.khurshid.com/sebs/?page=portfolio_Table

Regards,
Kush

Karl Swedberg wrote:

Hi Kush,

It looks like you're using jquery.latest.js. That one won't work  
with the .fadeIn() and .fadeOut().


As I mentioned before, you'll need the most recent nightly build.

Actually, scratch that. It looks like the file there is dated  
2007-03-01 (Rev: 1472):

http://jquery.com/src/nightlies/jquery-nightly.js

So, I put the latest svn builds up on my test server if you want  
to grab one and try the row stuff with it. It works fine with my  
tables:



* $Date: 2007-03-16 16:37:10 -0400 (Fri, 16 Mar 2007) $
* $Rev: 1538 $


http://test.learningjquery.com/scripts/jquery.js
http://test.learningjquery.com/scripts/jquery.lite.js
http://test.learningjquery.com/scripts/jquery.pack.js

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 17, 2007, at 7:36 PM, Kush Murod wrote:


Hi Karl,

Your idea is great workaround, I have tried it http:// 
www.khurshid.com/sebs/?page=portfolio_Table

However still something weird as you can see
Maybe I should just give up and use pure CSS
Thanks for help

Kush

Karl Swedberg wrote:
there have already been a number of threads related to the  
problems with showing and hiding table rows.


In a nutshell, table rows get mangled in Firefox when using any  
of the animated show and hide techniques because of FF's use of  
display:table-row and jQuery's setting animated elements to  
display:block when showing them. The non-animated .show()  
and .hide() work fine. Also, John Resig just posted a fix to  
opacity-related bugs yesterday, so you might be able to  
use .fadeIn() and .fadeOut() with table rows if you grab the  
latest nightly build:


http://docs.jquery.com/Downloading_jQuery#Nightly_Builds

While .slideDown() and .show('speed') still won't work properly  
in FF, you could use .fadeIn() as a compromise if you need some  
animation. For example,


$('tr:eq(2)').fadeOut('slow');
and
$('tr:eq(2)').show().fadeIn('slow');

to hide and show the third table row.

Also, you may find the solution in this thread helpful as well  
for doing the slide:
http://www.nabble.com/Hiding-and-showing-table-rows- 
tf2585537.html#a7208756




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 17, 2007, at 11:11 AM, Rick Faircloth wrote:


Hi, Kush...

Looks like the responses are kinda slow today, so this newbie
(only working with jQuery for about 2 weeks) will tell you the  
little

he's learned.

I was very interested in using sliding table rows for exposing  
details
of calendar events.  I could get the rows sliding, but was  
never happy

with how smoothly they would show  hide.

I tried using two separate tables, one for the always showing  
event
summary and another for the showing  hiding details.  That  
performed

really well.  Don't ask me why.

Here's an example of what I did showing the concept.   It's  
just a couple

of headings and then when you click you see the details.

http://resm.whitestonemedia.com/html/trial_slide.cfm

Don't worry about the This is the part to click. line...  
that's just

experimentation.

Is it performance of the show/hide you're concerned about?

Rick


-Original Message-
From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On

Behalf Of Kush Murod
Sent: Saturday, March 17, 2007 8:44 AM
To: jQuery Discussion.
Subject: Re: [jQuery] slideDown/slideUp problems when using tables

Hi, me again

I meant I need some help with sliding table rows (tr) which  
doesn't

slide properly as it does when using divs

Thanks,
Kush





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss

Re: [jQuery] Event not firing inside unhidden div

2007-03-18 Thread Karl Swedberg

Hi Kim,

My friend Jonathan Chaffer posted a reply to a similar question that  
I think you might find helpful. Here it is:



In the near future there will be a dead-tree reference for jQuery on
the shelves. A short excerpt from the first draft should prove
applicable to this conversation:
---

AJAX and Events: Handling the Handlers

Suppose we wanted to highlight all the h3 elements on the page when
they are clicked. By now the code to perform such a task is almost
second-nature:

$(document).ready(function() {
   $('h3').click(function() {
 $(this).toggleClass('highlighted');
   });
});

All is well, in that clicking on the letters on the left side of the
page highlights them. But the dictionary terms are also h3
elements, and they do not get the highlight. Why?
The dictionary terms are not yet part of the DOM when the page is
loaded, so the event handlers are never bound. This is an example of
a general issue with event handlers and AJAX calls: loaded elements
must have all of their event handlers rebound.

A first pass at solving this problem is to factor the binding out
into a function, and call that function both at the time the document
is ready and after the AJAX call:

$(document).ready(function() {
   var bindBehaviors = function() {
 $('h3').click(function() {
   $(this).toggleClass('highlighted');
 });
   }

   bindBehaviors();

   $('#letter-a .button').click(function() {
 $('#dictionary').hide().load('a.html', function() {
   bindBehaviors();
   $(this).fadeIn();
 });
   });
});

Now we can put all our event handlers in the bindBehaviors()
function, and call that whenever the DOM changes. Clicking on a
dictionary term now highlights it, as we intended. Unfortunately,
we've also managed to cause very strange behavior when the letters
are clicked. At first they highlight correctly, but after the button
is clicked (loading the dictionary entries), they no longer highlight
on subsequent clicks.

Closer inspection reveals that, after the AJAX call, the highlighting
breaks because the click handler is fired twice. A
doubled .toggleClass() is the same as none at all, so the click seems
not to work. A tricky behavior to debug, to be sure. The culprit here
is bindBehaviors(), which binds the click event to all h3 elements
each time. After a button click, there are actually two event
handlers for clicks on an h3, which happen to do the exact same  
thing.


Scoping an Event Binding Function

A nice way around this double-firing is to pass some context into
bindBehaviors() each time we call it. the $() constructor can take a
second argument, a DOM node to which the search is restricted. By
using this feature in bindBehaviors(), we can avoid multiple event
bindings:

$(document).ready(function() {
   var bindBehaviors = function(scope) {
 $('h3', scope).click(function() {
   $(this).toggleClass('highlighted');
 });
   }

   bindBehaviors(this);

   $('#letter-a .button').click(function() {
 $('#dictionary').hide().load('a.html', function() {
   bindBehaviors(this);
   $(this).fadeIn();
 });
   });
});

The first time bindBehaviors() is called, the scope is document, so
all h3 elements in the document are matched and have the click
event bound. After an AJAX load, though, the scope is instead the
div id=dictionary element, so the letters are not matched and are
left alone.

Using Event Bubbling

Adding scope to a behavior-binding function is often a very elegant
solution to the problem of binding event handlers after an AJAX load.
We can often avoid the issue entirely, however, by exploiting event
bubbling. We can bind the handler not to the elements that are
loaded, but to a common ancestor element:

$(document).ready(function() {
   $('body').click(function(e) {
 if ($(e.target).is('h3')) {
   $(e.target).toggleClass('highlighted');
 }
   });
});

Here we bind the click event handler to the bodyelement. Because
this is not in the portion of the document that is changed when the
AJAX call is made, the event handler never has to be re-bound.
However, the event context is now wrong, so we compensate for this by
checking what the event's target attribute is. If the target is of
the right type, we perform our normal action; otherwise, we do  
nothing.




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 18, 2007, at 2:24 PM, Kim Johnson wrote:


I have a div which is invisible by default, and
becomes visible via slidetoggle when a button is
clicked. Inside the div is dynamic content via ajax --
i take the responseText of an ajax call, and then
append it to an empty div (inside the slidetoggled
div) via .html(ajaxreponsevar). I do it this way
because I use the same div for multiple bits of
dynamic content, a different bit depending on which
button is clicked.

This approach works fine for getting/showing the
dynamic content. However, now I'm trying to add

Re: [jQuery] slideDown/slideUp problems when using tables

2007-03-17 Thread Karl Swedberg
there have already been a number of threads related to the problems  
with showing and hiding table rows.


In a nutshell, table rows get mangled in Firefox when using any of  
the animated show and hide techniques because of FF's use of  
display:table-row and jQuery's setting animated elements to  
display:block when showing them. The non-animated .show() and .hide()  
work fine. Also, John Resig just posted a fix to opacity-related bugs  
yesterday, so you might be able to use .fadeIn() and .fadeOut() with  
table rows if you grab the latest nightly build:


http://docs.jquery.com/Downloading_jQuery#Nightly_Builds

While .slideDown() and .show('speed') still won't work properly in  
FF, you could use .fadeIn() as a compromise if you need some  
animation. For example,


$('tr:eq(2)').fadeOut('slow');
and
$('tr:eq(2)').show().fadeIn('slow');

to hide and show the third table row.

Also, you may find the solution in this thread helpful as well for  
doing the slide:
http://www.nabble.com/Hiding-and-showing-table-rows- 
tf2585537.html#a7208756




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 17, 2007, at 11:11 AM, Rick Faircloth wrote:


Hi, Kush...

Looks like the responses are kinda slow today, so this newbie
(only working with jQuery for about 2 weeks) will tell you the little
he's learned.

I was very interested in using sliding table rows for exposing details
of calendar events.  I could get the rows sliding, but was never happy
with how smoothly they would show  hide.

I tried using two separate tables, one for the always showing event
summary and another for the showing  hiding details.  That performed
really well.  Don't ask me why.

Here's an example of what I did showing the concept.   It's just a  
couple

of headings and then when you click you see the details.

http://resm.whitestonemedia.com/html/trial_slide.cfm

Don't worry about the This is the part to click. line... that's just
experimentation.

Is it performance of the show/hide you're concerned about?

Rick


-Original Message-
From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On

Behalf Of Kush Murod
Sent: Saturday, March 17, 2007 8:44 AM
To: jQuery Discussion.
Subject: Re: [jQuery] slideDown/slideUp problems when using tables

Hi, me again

I meant I need some help with sliding table rows (tr) which doesn't
slide properly as it does when using divs

Thanks,
Kush





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] slideDown/slideUp problems when using tables

2007-03-17 Thread Karl Swedberg

Hi Kush,

It looks like you're using jquery.latest.js. That one won't work with  
the .fadeIn() and .fadeOut().


As I mentioned before, you'll need the most recent nightly build.

Actually, scratch that. It looks like the file there is dated  
2007-03-01 (Rev: 1472):

http://jquery.com/src/nightlies/jquery-nightly.js

So, I put the latest svn builds up on my test server if you want to  
grab one and try the row stuff with it. It works fine with my tables:



* $Date: 2007-03-16 16:37:10 -0400 (Fri, 16 Mar 2007) $
* $Rev: 1538 $


http://test.learningjquery.com/scripts/jquery.js
http://test.learningjquery.com/scripts/jquery.lite.js
http://test.learningjquery.com/scripts/jquery.pack.js

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 17, 2007, at 7:36 PM, Kush Murod wrote:


Hi Karl,

Your idea is great workaround, I have tried it http:// 
www.khurshid.com/sebs/?page=portfolio_Table

However still something weird as you can see
Maybe I should just give up and use pure CSS
Thanks for help

Kush

Karl Swedberg wrote:
there have already been a number of threads related to the  
problems with showing and hiding table rows.


In a nutshell, table rows get mangled in Firefox when using any of  
the animated show and hide techniques because of FF's use of  
display:table-row and jQuery's setting animated elements to  
display:block when showing them. The non-animated .show() and .hide 
() work fine. Also, John Resig just posted a fix to opacity- 
related bugs yesterday, so you might be able to use .fadeIn()  
and .fadeOut() with table rows if you grab the latest nightly build:


http://docs.jquery.com/Downloading_jQuery#Nightly_Builds

While .slideDown() and .show('speed') still won't work properly in  
FF, you could use .fadeIn() as a compromise if you need some  
animation. For example,


$('tr:eq(2)').fadeOut('slow');
and
$('tr:eq(2)').show().fadeIn('slow');

to hide and show the third table row.

Also, you may find the solution in this thread helpful as well for  
doing the slide:
http://www.nabble.com/Hiding-and-showing-table-rows- 
tf2585537.html#a7208756




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 17, 2007, at 11:11 AM, Rick Faircloth wrote:


Hi, Kush...

Looks like the responses are kinda slow today, so this newbie
(only working with jQuery for about 2 weeks) will tell you the  
little

he's learned.

I was very interested in using sliding table rows for exposing  
details
of calendar events.  I could get the rows sliding, but was never  
happy

with how smoothly they would show  hide.

I tried using two separate tables, one for the always showing event
summary and another for the showing  hiding details.  That  
performed

really well.  Don't ask me why.

Here's an example of what I did showing the concept.   It's just  
a couple

of headings and then when you click you see the details.

http://resm.whitestonemedia.com/html/trial_slide.cfm

Don't worry about the This is the part to click. line... that's  
just

experimentation.

Is it performance of the show/hide you're concerned about?

Rick


-Original Message-
From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On

Behalf Of Kush Murod
Sent: Saturday, March 17, 2007 8:44 AM
To: jQuery Discussion.
Subject: Re: [jQuery] slideDown/slideUp problems when using tables

Hi, me again

I meant I need some help with sliding table rows (tr) which doesn't
slide properly as it does when using divs

Thanks,
Kush





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Select in frames

2007-03-16 Thread Karl Swedberg

On Mar 16, 2007, at 3:23 AM, George Moschovitis wrote:

Dear devs,

I have a short question. Is there a jquery shortcut for the  
following js code:
   document.getElementById 
('myframe').contentWindow.document.getElementById('myframe').submit();


I am trying to programmatically submit a form in an iframe.

thanks in advance,
George.



Hi George,

That is a very timely question!

Witness the following thread just posted to the dev list:


On Mar 15, 2007, at 12:25 PM, John Resig wrote:

That resulting patch is great. It only seems to add about 1 line of
code (which is just perfect). I'll try and do some testing on it
tonight, and get it merged in. Great work!

--John

On 3/15/07, Volker Mische [EMAIL PROTECTED] wrote:

Hi,

adding nodes to iframes in Internet Explorer doesn't work at the  
moment,

as the container for the dom tree gets generated with
document.doc.createElement(div). Internet Explorer has security
restrictions that new nodes need to be generated in the same  
context as

the iframe. This would mean something like:
document.iframe.contentWindow.document.createElement(div). To  
fix this

issue clean() gets a second argument, which passes document object of
the current context.
I attached a JavaScript file which can be included after  
jquery-1.1.2.js
so you can test it. A patch is attached at http://dev.jquery.com/ 
ticket/978.


Cu,
  Volker.



So, it looks like this feature is imminent. Unless, of course, I've  
misunderstood your question, which is entirely possible.


Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Powered Sites - Keep the Links Coming

2007-03-15 Thread Karl Swedberg

Well done, Tony!

One suggestion for the image replacement technique on the  
#RSSexualPredators a element is to add

  overflow: hidden;

Otherwise, Firefox shows the unsightly dotted border across the  
entire width of the page when the link gets focus because of the text- 
indent: -em.


Cheers,

p.s. when José writes...

the search of the sexual offenders in the maps, simply genial
... I'm sure this is a simple (Freudian?) slip of the translation  
dictionary, but I think a better translation would be simply  
genital. :-)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 15, 2007, at 4:30 AM, SeViR wrote:


rip747 escribió:
I actually just got done redesigning www.sheriff.org and used  
jQuery for all

the javascript on the site.



wow! very nice site, the search of the sexual offenders in the maps,
simply genial

--
Best Regards,
 José Francisco Rives Lirola sevir1ATgmail.com

 SeViR CW · Computer Design
 http://www.sevir.org

 Murcia - Spain


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] bgiframe update, sneak peak

2007-03-15 Thread Karl Swedberg
and on the mac side, TextMate has a subversion bundle built right in.  
It's a beautiful thing.


http://macromates.com


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 15, 2007, at 10:26 AM, Aaron Heimlich wrote:


On 3/15/07, agent2026 [EMAIL PROTECTED] wrote:

Thanks for the help, that's what I thought.  I've never really  
tried to use

SVN.  Is there a frontend you recommend?

On Windows, there's TortoiseSVN[1], which integrates directly into  
the Explorer shell. If you're working in Eclipse there's Subclipse 
[2] (which I use regularly and works wonderfully) and Subversive  
(which I haven't used).



[1] http://tortoisesvn.tigris.org/
[2] http://www.eclipseplugincentral.com/Web_Links-index-req- 
viewlink-cid-47.html
[3]http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink- 
cid-611.html


--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery newbies?

2007-03-14 Thread Karl Swedberg

Hey Jörn,

I think it's totally cool that someone with your level of expertise,  
someone whose coding prowess I aspire to, also has the self- 
confidence to post such a question!


Anyway, the distinction between newbie and expert is, in my opinion,  
irrelevant nearly all of the time. Much more important than  
expertise, for developers at least, are intelligence and  
creativity. And from everything I've seen from you on this list, your  
blog, and your plugins, you have a lot of both.  :-)



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 13, 2007, at 6:25 PM, Jörn Zaefferer wrote:


Nathan Young -X (natyoung - Artizen at Cisco) schrieb:
I think knowing what this is and being able to use it  
appropriately is pretty critical.


I think never having given a flying *** about self and having no  
idea what it is, is totally natural and not indicative of anything.



Thanks all for your replies.

I agree that knowing about self isn't critical, but its also true that
these are the details that an expert should know about. Thanks for
enlightening me :-)

--
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to bind a hover event?

2007-03-14 Thread Karl Swedberg

On Mar 14, 2007, at 11:07 AM, Juha Suni wrote:


Daniel Hofstetter wrote:

Somehow I can't figure out how to bind a hover event to an element.


Something wrong with?
$(this).hover(
functionA,functionB
);


Daniel,
Just to connect the dots for you, you'll often want to use anonymous  
functions for both arguments. So, it would look like this:


$(this).hover(function() {
  // Stuff to do when the mouse enters the element;
}, function() {
  // Stuff to do when the mouse leaves the element;
});

Don't know if you needed that extra explanation, but I guess it can't  
hurt. :)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Selecting only one level in DOM and no deeper

2007-03-14 Thread Karl Swedberg

The  says only the first instance of that object.


Hey Andy, I think I know what you meant there, but the wording might  
be a little misleading. The  will get *all* instances of the li  
element that are children of the preceding ul element. It just  
won't get any li elements that are grandchildren (or great- 
grandchildren, etc.) of the ul.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 14, 2007, at 11:10 AM, Andy Matthews wrote:


Use the descendant selector.

Div ul li
Vs
Div ul  li

The  says only the first instance of that object.

-Original Message-
From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On

Behalf Of Dan Eastwell
Sent: Wednesday, March 14, 2007 10:01 AM
To: jQuery Discussion.
Subject: [jQuery] Selecting only one level in DOM and no deeper

I have a function

function closeSubModules(subModules){
for(var i=0; i  subModules.length; i++){
theElement = subModules[i]; 
$(theElement).hide();
}   
}

one of the subModules[i] I've passed this function in an array is  
#faq li

ul and hides all the sub-modules e.g.

div id=faq
ul
li
ul !-- hide this --
   
/ul
/li
/ul

I've another function that toggles the hidden submodules onclick of  
another

element on the page.

If the submodule has a list inside it (e.g. as bullet points within  
some

text) these get hidden by closeSubModules() but don't get shown by the
toggle function (that only targets the #faq li ul level and no  
deeper).


I've added this to my toggle function,

$(theItems).children(ul).show();

but that is a bit of a hack and only goes one level deep, and won't  
show

nested lists within any text in the module.

Any thoughts?

Thanks,

Dan.

--
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] serialize form

2007-03-14 Thread Karl Swedberg


On Mar 14, 2007, at 11:40 AM, Mike Alsup wrote:


The use case is an autosave for the form. I looked at the form plugin
and it seemed to want to take control of the form submit. In my use
case I want to save the form in the background and let the user
continue to work with the form.


I would recommend using the form plugin.  Its primary function is to
provide ajax capabilities.  I'd be glad to help if you found it
confusing or if you have questions about it.


I second that recommendation! The form plugin makes ajax form  
submission astonishingly easy.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] on resize in jquery?

2007-03-14 Thread Karl Swedberg

On Mar 14, 2007, at 5:43 PM, Erik Beeson wrote:


IIRC, some browsers fire the resize event on load, and some don't.
Watch out for that.


Another thing you might need to watch out for is that some browsers  
fire the resize event as soon as the resizing stops while others fire  
it continuously as you resize. Can't remember which does which.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] rollodex ui

2007-03-14 Thread Karl Swedberg

On Mar 14, 2007, at 7:53 PM, Erik Beeson wrote:



If you're wanting the details content to hover over the top of your
rows, you might look into something like the modal plugin. Maybe you
could have an onmouseout handler on the modal content to hide it.


Another option for the hovering effect might be one of the tooltip  
plugins:


http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
http://www.dave-cohen.com/node/1186
http://www.learningjquery.com/2006/10/updated-plugin-jtip

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Fastest selector for searching a single table column?

2007-03-13 Thread Karl Swedberg
Ah, I think I understand what you're getting at now. Alas, I don't  
know of anything that would work faster than the $('td:nth-child(n)')  
selector expression. I'll try to give it some more thought, though,  
and if I have any ideas, I'll post them. Sorry I couldn't be of more  
help.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 12, 2007, at 11:11 PM, Daemach wrote:



Thanks Karl -

That suggestion works for applying an attribute to an entire column  
of a
table, but I need to apply a custom selector which means looping  
over the

rows.  My selector is using a regex, and I need to compare a matched
subexpression so if the regex is operating on unexepected values it  
bombs.

Limiting it to one column would solve that problem.


Karl Swedberg-2 wrote:


Dave Methvin answered this question back in October and then again in
February:

http://www.nabble.com/Re%3A-highlight-table-column-on-hover-
p7074977.html

Hope that helps.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 12, 2007, at 3:40 PM, Daemach wrote:



So on the selector question, is there any jQuery selector that
would enable
me to limit the search to a single table column?


Daemach wrote:


In my ongoing quest to master jQuery I had an itch to write a table
filtering mechanism.  I'm going for speed and elegance here so I
want this
to work fast enough to bind to a keyup event without bogging down
even on
long tables.  Using DOM coding if I wanted to search the 3rd
column only I
would loop over oTable.rows[i].cells[2] to find the values.   
jQuery's

selectors are pretty generalized, so I'm wondering if there is a
jQuery
selector that is equally efficient.

$(td:nth-child(3), #mytbody#) perhaps?  Some kind of xpath
expression?

If I had a text field in the table header row, what would be the
easiest
way to figure out what column it was in so I could pass that to the
selector?



--
View this message in context: http://www.nabble.com/Fastest-
selector-for-searching-a-single-table-column-- 
tf3382725.html#a9441789

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
View this message in context: http://www.nabble.com/Fastest- 
selector-for-searching-a-single-table-column--tf3382725.html#a9447729

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] finding y position

2007-03-13 Thread Karl Swedberg

Hi Rolf,

By far the easiest way to do that is to use the Dimensions plugin. It  
is amazingly accurate, even taking into account borders, padding,  
overflow:scroll, etc.


http://docs.jquery.com/Plugins

The inline documentation is quite helpful as well.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 13, 2007, at 8:46 PM, rolfsf wrote:



I want to find the position of the top of a div (distance from top of
window), so I can calculate and set the height of another div. How  
can I get
that? I'm a little confused as to how to use offset, which returns  
values

for both x and y.

Thanks!
--
View this message in context: http://www.nabble.com/finding-y- 
position-tf3399556.html#a9466593

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] finding y position

2007-03-13 Thread Karl Swedberg

Sure thing. You can get at the separate offsets (top and left) like so:

$('#my-id').offset().top;
$('#my-id').offset().left;

I hope that's what you were looking for. If not, let me know.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 13, 2007, at 10:53 PM, rolfsf wrote:



thanks Karl - I've looked through dimensions.js

and being a newbie... I still don't understand how to use offset  
when I only

want one dimension (e.g. y position)

a little hint, maybe, and I'll be on my way



Karl Swedberg-2 wrote:


Hi Rolf,

By far the easiest way to do that is to use the Dimensions plugin. It
is amazingly accurate, even taking into account borders, padding,
overflow:scroll, etc.

http://docs.jquery.com/Plugins

The inline documentation is quite helpful as well.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 13, 2007, at 8:46 PM, rolfsf wrote:



I want to find the position of the top of a div (distance from  
top of

window), so I can calculate and set the height of another div. How
can I get
that? I'm a little confused as to how to use offset, which returns
values
for both x and y.

Thanks!
--
View this message in context: http://www.nabble.com/finding-y-
position-tf3399556.html#a9466593
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
View this message in context: http://www.nabble.com/finding-y- 
position-tf3399556.html#a9467686

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Fastest selector for searching a single table column?

2007-03-12 Thread Karl Swedberg
Dave Methvin answered this question back in October and then again in  
February:


http://www.nabble.com/Re%3A-highlight-table-column-on-hover- 
p7074977.html


Hope that helps.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 12, 2007, at 3:40 PM, Daemach wrote:



So on the selector question, is there any jQuery selector that  
would enable

me to limit the search to a single table column?


Daemach wrote:


In my ongoing quest to master jQuery I had an itch to write a table
filtering mechanism.  I'm going for speed and elegance here so I  
want this
to work fast enough to bind to a keyup event without bogging down  
even on
long tables.  Using DOM coding if I wanted to search the 3rd  
column only I

would loop over oTable.rows[i].cells[2] to find the values.  jQuery's
selectors are pretty generalized, so I'm wondering if there is a  
jQuery

selector that is equally efficient.

$(td:nth-child(3), #mytbody#) perhaps?  Some kind of xpath  
expression?


If I had a text field in the table header row, what would be the  
easiest

way to figure out what column it was in so I could pass that to the
selector?



--
View this message in context: http://www.nabble.com/Fastest- 
selector-for-searching-a-single-table-column--tf3382725.html#a9441789

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Hide All Except One (tabs)

2007-03-12 Thread Karl Swedberg

Hi Charles,

This bug has been fixed. If you download a nightly build, it should  
work fine using .attr('href')

http://docs.jquery.com/Downloading_jQuery#Nightly_Builds


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 12, 2007, at 7:54 PM, Charles Stuart wrote:


From what I can tell, it wasn't working because of this bug:

http://dev.jquery.com/ticket/745

When getting href on IE it returns the entire URL, instead of the
attributes value.

I've put in a hack to fix, an attribute of toggle in the markup, and
the grab that value instead.

Is there a better workaround?


best,
Charles



On 3/12/07, Charles Stuart [EMAIL PROTECTED] wrote:

Oops. Thanks. I'll fix that...

Charles


On 3/12/07, Bruce [EMAIL PROTECTED] wrote:

Charles,
it works great in firefox, but in ie6 on a pc I get a blank page  
when

clicking on the other two links...

Bruce P
bkdesign

- Original Message -
From: Charles Stuart [EMAIL PROTECTED]
To: discuss@jquery.com
Sent: Monday, March 12, 2007 3:36 PM
Subject: [jQuery] Hide All Except One (tabs)



Hello,

An implementation of tabs using jquery.
* http://enure.net/dev/hide-all-except-one/ (demo)
* http://enure.net/dev/hide-all-except-one/hideAllExcept.js (js)

I think it's pretty simple. Just 15 lines... Any feedback is  
appreciated.


best,
Charles

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/






___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Is there a CSS doctor in the house?

2007-03-09 Thread Karl Swedberg
Abel, send me the files and I'll post them at http:// 
test.learningjquery.com so that people here can have a go at them.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 9, 2007, at 5:02 AM, Abel Tamayo wrote:

The problem is that I don't have server to uploadt it to, and this  
forum doesn't let you attach files past a determined weight (wich  
is too small and I always have my attachments banned). That's why I  
said I would send a sample to those caring souls that could pay me  
some attention.
Now I'm sending a sample to Schnuck and Dan, but I repeat it's not  
a jQuery problem about states, selectors, classes or anything. It's  
more about laying it out to look good.


Abel.

On 3/9/07, Dan Eastwell [EMAIL PROTECTED] wrote:
Have I missed the rest of this thread? Do you have

a) Sample HTML/CSS to look at and
b) What you'd like it to look like on each of the states.

I'll be happy to look at the problem, being a CSS person.

On 3/9/07, Abel Tamayo [EMAIL PROTECTED] wrote:
 Nah, that's easy.
 The problem is I can't make the lists of lists look like an array of
 buttons, and some of them place themselves in places I don't want  
them to.
 It´s a matter pf position and display, I know that for sure, but  
still I

 can't make it work.
 Thanks anyway.

 On 3/9/07, Kenneth [EMAIL PROTECTED] wrote:
  If you're talking about the dimming of the buttons on the GUI,  
it could be

 done like so:
 
  $(function(){
  $('.gui').hover(function(){
  $(this).animate({opacity: .3}, 1);
  },function(){
  $(this).animate({opacity: 1}, 1);
  });
  });
 
 
 
 
 
  On 3/9/07, Abel Tamayo [EMAIL PROTECTED]  wrote:
  
   I'm sorry to post a non jQuery related question in the board,  
but I
 spent the whole day of yesterday on this and I need it to work  
for my jQuery

 plugin (So, somehow, it IS jQuery related).
   The thing is I have a list of buttons and I can't make the color
 selectors (foreground and hilite color) look like the ones here.  
I was
 wondering if anyone here would be so kind so that if I send him  
the HTML and
 the images they could fix it. I know it must be something really  
simple like
 adjusting position, float, display or something like that, but  
I'm stuck and

 don't know what to do.
   Again, it's only css related: no jQuery or programming of any  
kind. If
 someone would be so nice, please answer and I will send him the  
files (HTML
 and images, i repeat you don't have to worry about the code ).  
That or maybe

 someone can address me to a cs board.
   Thanks
  
   Abel.
  
   ___
   jQuery mailing list
   discuss@jquery.com
   http://jquery.com/discuss/
  
  
 
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 
 


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/




--
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] interface accordion

2007-03-09 Thread Karl Swedberg





On Mar 9, 2007, at 7:35 AM, Dimitris Chrysomallis wrote:


i got the same problem. You could use the Accordion plugin from here
where you have to set the property active: none. But then, i  
think that using that plugin creates conflicts with the Interface  
namespace.


2007/3/9, Indigo [EMAIL PROTECTED]:

Folks,

How do I set an accordion to not have an open panel when the page  
loads? The
only option I see on the interface doc page is currentPanel, but  
assigning

it a value of 0 does not do what I want.

Any ideas?

TIA



Jörn's plugin mentioned above is awesome. Also, I've written a number  
of tutorials on accordion menus:


http://www.learningjquery.com/2007/03/accordion-madness
http://www.learningjquery.com/2007/02/more-showing-more-hiding (this  
one discusses the effect you're requesting)

http://www.learningjquery.com/2006/09/slicker-show-and-hide


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] finding an image by src attribute

2007-03-07 Thread Karl Swedberg

Hi Paul,

This should do it:

$('[EMAIL PROTECTED]')


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 6, 2007, at 1:34 PM, Paul wrote:

This is probably easy, but it’s my first attempt so I’m not sure  
where to begin…




I have a series of images which all have the class “ico”.  Within  
that collection of images I need to find any with src set to “ico- 
fail.png”.  How can I efficiently search through the images to  
determine if any have this attribute?




Thanks!



Paul

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] select all images under a div, and change their widths proportionally?

2007-03-06 Thread Karl Swedberg
what if the images are narrow than 250px? Should they keep their  
original width, or should they be changed to 250px as well?


If you only want to adjust the width of the images that are wider  
than 250px, you could do this:


$('#blogreviews img').each(function(index) {
  if ($(this).width()  250) {
$(this).css('width', '250px');
  }
});



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 6, 2007, at 10:54 PM, Alp Guneysel wrote:


wow, that was stupid of me...
thanks.


On 3/7/07, Chris Domigan [EMAIL PROTECTED] wrote:
Try:

$(#blogreviews img).css(width,250px);

Chris

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] onclick functionality

2007-03-05 Thread Karl Swedberg

Hi Stella,

One of the beautiful things about jQuery is that you don't need to  
put IDs everywhere in your markup just to do simple show/hide effects.


My most recent blog entry, Accordion Madness, shows a couple ways you  
can achieve the showing and hiding effect, and it links to previous  
entries on the same topic, as well as Jörn Zaefferer's Accordion plugin.

http://www.learningjquery.com/2007/03/accordion-madness

For your markup, you could use this code:

$(document).ready(function () {
  $('div.answer').hide();
  $('div.question').click(function() {
$(this).next('div.answer').slideToggle('fast');
  });
});


I used .slideToggle('fast') because I like the way it looks, but you  
could replace that with a regular .toggle()


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 5, 2007, at 8:32 AM, Stella Power wrote:


Hi,

I'm new to jQuery so please bear with me if this is a stupid  
question.  I have gone through the tutorials on the site by the  
way, I just haven't found a solution to it yet.


I have a page that is created on the fly using php.  On the page  
there are a variable number of question-answer pairs.  Each  
question and answer is in their own div and have their own unique  
ids.  Using the ready function I've set each answer to be hidden -  
this was simple because each answer div has the same class.  When a  
user clicks on the question, I want the answer to appear underneath  
this.  I'm using the toggle() function for this.


It all works as expected.  However, in order to toggle the correct  
answer div, I've hardcoded the div ids.  I need a way of  
identifying which question was clicked on and then toggle the  
appropriate answer.  Is there anyway to pass in an argument perhaps?


My generated html code is like:
div class=questions
  div class=question id=question_123.../div
  div class=answer id=answer_123/div
  div class=question id=question_739.../div
  div class=answer id=answer_739/div
/div

My jQuery code is:

  $(document).ready(function () {
$('div.answer').hide();
$(#question_123).click(function() {   $(#answer_123).toggle 
();   });
$(#question_739).click(function() {   $(#answer_739).toggle 
();   });

  });

Cheers,
Stella
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] onClickOut?

2007-03-05 Thread Karl Swedberg

Thanks for the clarification, John!


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 5, 2007, at 10:55 AM, John Resig wrote:


.one() is not deprecated. With 1.1 we simply have an alternative to
.one() using the .unbind() function (allowing the event to be
triggered only a specific number of times).

--John

On 3/5/07, Klaus Hartl [EMAIL PROTECTED] wrote:

Karl Swedberg schrieb:

Hey Yehuda,

.one('event',fn) has not been deprecated, as far as I know. Only the
individual .oneEvent(fn) methods have.


--Karl


Yes, this is what I thought as well... I'm confused.


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to find a div with a class ending with a string?

2007-03-05 Thread Karl Swedberg

Dave,

You can find all of this information in the documentation at
http://docs.jquery.com/Selectors


 Supported, but different

All attribute selectors are written like their XPath counter-parts  
(in that all attributes should begin with an @ symbol).


* [EMAIL PROTECTED] an E element with a foo attribute
* [EMAIL PROTECTED] an E element whose foo attribute value is  
exactly equal to bar
* [EMAIL PROTECTED] an E element whose foo attribute value begins  
exactly with the string bar
* [EMAIL PROTECTED] an E element whose foo attribute value ends  
exactly with the string bar
* [EMAIL PROTECTED] an E element whose foo attribute value  
contains the substring bar


So, in your case, you could do something like this:

$('[EMAIL PROTECTED]', this)

Hope that helps.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 5, 2007, at 5:07 PM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:



Hi,

This mailing list has been great and helped me figure out how to  
find elements starting with a pattern ...


$(this).find([EMAIL PROTECTED]);

My question now is how to find elements ending with a pattern.   
Specifically, I'm trying to find all DIVs that are within $(this)  
whose class ends with -1.


Thanks, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Auto Vertical Scroller newsBlock div

2007-03-05 Thread Karl Swedberg

Hi there,

I did something like this a while ago. Not sure if it's exactly what  
you're looking for, but it might get your closer:

http://www.learningjquery.com/2006/10/scroll-up-headline-reader

Glen Lipka used the code for a mockup of the Intuit home page when he  
was working there. His version looks much prettier than mine. :) Look  
at the bottom right box:

http://glenlipka.kokopop.com/jQuery/intuit.com/

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 5, 2007, at 5:56 PM, {js}sTyler wrote:



Hi All,
   Anyone have any tips for me to do a sort of news scroll vertical
scrolling div?
Mine is here:
http://70.133.226.219/v2/07index.aspx

It's beneath the jquery buttons in the left column.
It is scrolling up or sort of ticking up, if you give it a few  
seconds you

will see the headlines tick up.
I know the Css styling isn't quite right yet to tell the headlines  
apart

from each other, but that's a cinch to fix.

I tried implementing JD Sharp's code from here:
http://jdsharp.us/code/jQuery/plugins/jdNewsScroll/
It's sort of working but not really scrolling.

Any ideas to fix this or another setup, I don't really like the  
headline
reader that scrolls up quickly to the top and pauses, a plain old  
smooth

scroller would probably be best.

DynamicDrive has quite a few of those, but they haven't been jQuery- 
ized,
and I don't quite get how to lay the smack down on my own original  
coding

yet, or anywhere near that skill level of coding :(
I've used this one in the past for example:
http://www.dynamicdrive.com/dynamicindex2/mikescroll.htm
The scripts in this dynamic drive example add around 22k of js code...
The jquery.dimensions.js from jd's example is just over 10k, my  
page is

getting heavy fast with so many client requests for animation.
Thanks for any suggestions!
--
View this message in context: http://www.nabble.com/Auto-Vertical- 
Scroller-newsBlock-div-tf3352363.html#a9322596

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] onClickOut?

2007-03-04 Thread Karl Swedberg

Hey Yehuda,

.one('event',fn) has not been deprecated, as far as I know. Only the  
individual .oneEvent(fn) methods have.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 4, 2007, at 8:21 AM, Yehuda Katz wrote:


one has been deprecated since 1.1. For the same effect, you *might* be
able to do e.unbind() inside the event handler, as such:

$(#n).click(function(e) { e.unbind(); // code; return false; });

I'm not 100% that syntax made it in. That said, I don't think that's
what you're looking for. I think you want to bind a click on body, and
test to make sure that e.target is not the element in question.

$(#n).click(function(e) {
  var self = this;
  $(#menu).show();
  $(body).click(function() {
if(e.target != self  e.target != $(#menu)[0]) $ 
(#menu).hide();

  })
})

Something like the above has worked for me in the past (obviously with
more code to actually DO what you're trying to accomplish).

On 3/4/07, Klaus Hartl [EMAIL PROTECTED] wrote:

Philip Pryce schrieb:
Is there some way of making a bind function so that, one you  
click away from
an element (say drop down menu) it disapears. So say i've clicked  
a button
and a menus poped up, i then taken a look at the menu and i dont  
need it
again, so i click on some other part of the page and the menu  
hides it self

again. Any ideas?


Philip, there is the one function, that does exactly what you need.

$('#target').one('click', function() {
...
});



-- Klaus


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] $(node).hasClass(...) function

2007-03-04 Thread Karl Swedberg
Maybe .hasClass() would be helpful, but keep in mind that .is()  
offers /more/ functionalities than .hasClass() would.


For example ...

$('.class').is('#my-id')
$('p').is(':visible')
$('div').is('[a]')

I'm not necessarily opposed to having .hasClass(), but I really love  
the flexibility of .is().


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 4, 2007, at 10:07 AM, Sébastien Pierre wrote:


Hi,

This is not very obvious, and I guess some people won't notice that
is offers the same functionalities as a potential hasClass...
from a developer friendly point of view, I think it would be better
to have addClass/toggleClass/hasClass rather than addClass/
toggleClass/is.

Just my 2c ;)

  -- Sébastien

Le 07-03-02 à 13:30, John Resig a écrit :


give this a try:

$(node).is(.class)

--John

On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote:

Hi all,

I was wondering if somebody would be interested in a hasClass(...)
function for jQuery. I would definitely find it useful, and am
willing to contribute it.

  -- Sébastien



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to block a function while another finishes? (and pause!)

2007-03-03 Thread Karl Swedberg

On Mar 3, 2007, at 3:05 PM, Klaus Hartl wrote:


Karl recently wrote about a neat trick to achieve the same without the
pause plugin:
http://www.learningjquery.com/2007/01/effect-delay-trick

Just do this:

target.children(div.middle).html(stuff).pause(2000,
'fx').animate({opacity: 1}, 2000).slideDown(slow);



Thanks for the nod, Klaus. I'm flattered.

Kim, not sure if this is worth mentioning, but Klaus forgot to delete  
the .pause(2000, 'fx') part from that example. It should look like this:


target.children(div.middle).html(stuff)
  .animate({opacity: 1}, 2000).slideDown(slow);

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animate() : background color

2007-03-02 Thread Karl Swedberg

Hi Alexandre,

The core jQuery .animate() method works only for properties that take  
numeric values (although you can use the shortcut strings show,  
hide, and toggle as well).


For animation of other CSS properties, or even classes, check out the  
Interface plugin suite (and ifx.js in particular):

http://interface.eyecon.ro
http://interface.eyecon.ro/docs/animate

Also, you don't need to add the easing parameter if you want it to be  
the default, linear.




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Mar 2, 2007, at 12:23 PM, Alexandre Plennevaux wrote:


hello!

i'm trying to have jquery fade between 2 colors, but can't get it  
to work, here is what i'm trying:


$('#contactForm').animate({left: 400, width: 300, height:  
600, backgroundColor: #617B8C},slow,linear,showContactInfo);
the docs specifies it must be camel cased, which i did . What am i  
doing wrong?



thank you !!

alexandre

Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte
Lakensestraat/Rue de Laeken 104
B-1000 Brussel-Bruxelles-Brussels
Belgie-Belgique-Belgium

Tel:+32(0)2.219.65.55
Fax:+32(0)2.426.69.86
Mobile:+32(0)476.23.21.42
http://www.lab-au.com
http://www.mediaruimte.be

__ 



The information in this e-mail is intended only for the addressee  
named above.  If you are not that addressee, please note that any  
disclosure, distribution or copying of this e-mail is prohibited.
Because e-mail can be electronically altered, the integrity of this  
communication cannot be guaranteed.


__ 





--
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.447 / Base de données virus: 268.18.5/707 - Date:  
1/03/2007 14:43


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nth-child selector

2007-02-28 Thread Karl Swedberg

Hi Dan,

jQuery doesn't support the :nth-child(an + b), only :nth-child(n)

To select every odd item except the first two items, try this instead:

$('#search-results div:nth-child(odd):gt(0)')



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 28, 2007, at 7:38 AM, Dan Eastwell wrote:


Hello,

I'm trying to select every odd  item in a list, but not the first  
two items.


I've tried using the nth-child selector, which is fine at picking out
the nth-child, but I can't get the 2n+2 child to be selected:

stripes(#search-results div:odd); // is ok
stripes(#search-results div:nth-child(2)); // works

but

stripes(#search-results div:nth-child(2n+2)); // doesn't.

Am I missing something about the CSS3 selector syntax?

Thanks,

Dan.

--
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Help with animate()

2007-02-27 Thread Karl Swedberg

On Feb 27, 2007, at 12:49 AM, Karl Rudd wrote:

Make sure the element you're trying to move (the div in this case)
has either position: relative or position: absolute.

Karl Rudd


Yes! Since I started using jQuery, the default position: static has  
taken on new meaning for me. :)



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 27, 2007, at 12:49 AM, Karl Rudd wrote:


Make sure the element you're trying to move (the div in this case)
has either position: relative or position: absolute.

Karl Rudd

On 2/27/07, David [EMAIL PROTECTED] wrote:


 Hi,

 I'm trying to understand how the animate function works, but I'm not
finding the documentation very helpful. As an example I would like  
to move
one div to the right 100 pixels. I thought that the following code  
might do

it but I get no movement whatsoever.

 $(#myDiv).animate({right: 100}, slow);

 Am I completely missing the point of the animate function? Can  
anybody

please give me a nudge in the right direction?

 Regards,

 David

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] appending text nodes

2007-02-22 Thread Karl Swedberg

Hi Dave,

Not sure where the item variable is coming from, but you can try  
setting the variable first with .text() and then just including that  
variable name in the append string.


Something like this:

var item = $('your-selector-goes-here').text();

And then, instead of $.text(item) in the append string, just use  
item. So:


$(this).parents(div.sidebarToDo).find(td.sidebarText).empty 
().append(input type=\text\ size=\10\ class=\editableTDItem 
\ value=\ + item + \);



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 22, 2007, at 11:06 AM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:



 ---Original Message---
 From: Kristinn Sigmundsson [EMAIL PROTECTED]
 Subject: Re: [jQuery] appending text nodes
 Sent: Feb 22 '07 15:42

 Hm, you empty it and then append to it? wouldn't that be the same as
 using .html(val)? If that is what you'd want to do, try the .text()
 command:
 $(this).parents(div.sidebarToDo).find(td.sidebarText).text(val)

 contents of td.sidebarText will be replaced with val

 On 2/22/07, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:

Hi, I want to append text to a node.  I'm using this code

$(this).parents(div.sidebarToDo).find(td.sidebarText).empty 
().append(val);


but if the variable val contains special characters, like  
td, that will mess up the rest of my tree.  What is the best  
way to handle this?


Thanks, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





Thanks.  This is what I wanted to do.  One further question about  
the text command.  I'm getting a JS error when I try to implement  
the following:


$(this).parents(div.sidebarToDo).find 
(td.sidebarText).empty().append(input type=\text\ size=\10\  
class=\editableTDItem\ value=\ + $.text(item) + \);


Your thoughts?  Thanks, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Reference to the last DIV in a group?

2007-02-22 Thread Karl Swedberg


Try this:

$('div.sidebarToDo:last')

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 22, 2007, at 12:07 PM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:



Hello,

I have a main div, with id= todoList, and within it, a number of  
DIVs, all with classes sidebarToDo.  Let's say I have just added  
a DIV to the DOM ...


$('#todoList').append('div class=sidebarToDo width=100%Hello/ 
div');


How do I now get a reference to this last DIV with class  
sidebarToDo?  Notice it doesn't have an ID, but it is the last  
one in the master todoList DIV.


Thanks so much.  This discussion group is excellent. - Dave


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Flickering problem with Interface Slide in FF2

2007-02-22 Thread Karl Swedberg

Hi Jim,

this bug has been fixed in the jQuery core (post 1.1.1). You can get  
a copy of the most recent nightly build here:

http://docs.jquery.com/Downloading_jQuery#Nightly_Builds


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 22, 2007, at 3:02 PM, Jim Nimblett wrote:


Hi everyone,

I am trying to get an image to slide out and then back in again.
Eventually, I will be displaying a new image with each rotation of the
slider. Unfortunately, there seems to be an issue in Firefox 2 were  
the
image is briefly displayed before it slides back in. This shows up  
as a

quick flicker.

I know there have been a few posts with similar problems... I was just
wondering if anyone found a solution. Perhaps I am just going about it
the wrong way.

Here is an example:

http://www.xrag.com/testing/animate/

Code is pretty simple:

  $(document).ready( function() {
 $(#testit).click(function() {
$(#foo).SlideToggleRight(2000, foo(), 'easeboth');
return false;
 });
  });
  function foo()
  {
 $(#foo).SlideToggleRight(2000, null, 'easeboth');
 return false;
  }


Thank you in advance.

- Jim


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Flickering problem with Interface Slide in FF2

2007-02-22 Thread Karl Swedberg

Yes, thanks, Stefan. And I hope I didn't cause any confusion, either!


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 22, 2007, at 5:33 PM, Brandon Aaron wrote:

Oh okay. Thanks for clearing that up. Hope I didn't cause any  
confusion. :)


--
Brandon Aaron

On 2/22/07, Stefan Petre [EMAIL PROTECTED] wrote:
For Slide, Drop, Fold etc Interface is not rewriting the FX. The  
problem

is elsewhere.


Brandon Aaron wrote:
It is fixed in the core but I believe Interface rewrites the fx  
module

of jQuery and the bug probably exists there as well.

Stefan, I can provide a patch for Interface if needed.

--
Brandon Aaron

On 2/22/07, Sanyi [EMAIL PROTECTED] wrote:

Sorry Karl, this did not have been fixed, as I tried it, the  
flickering

still exists on all effects except of fadeIn and fadeOut!
Bye Alex(Sanyi)


On 2/22/07, Karl Swedberg [EMAIL PROTECTED] wrote:


Hi Jim,


this bug has been fixed in the jQuery core (post 1.1.1). You  
can get a



copy of the most recent nightly build here:


http://docs.jquery.com/Downloading_jQuery#Nightly_Builds





--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com






On Feb 22, 2007, at 3:02 PM, Jim Nimblett wrote:


Hi everyone,


I am trying to get an image to slide out and then back in again.
Eventually, I will be displaying a new image with each rotation  
of the
slider. Unfortunately, there seems to be an issue in Firefox 2  
were the
image is briefly displayed before it slides back in. This shows  
up as a

quick flicker.


I know there have been a few posts with similar problems... I  
was just
wondering if anyone found a solution. Perhaps I am just going  
about it

the wrong way.


Here is an example:


http://www.xrag.com/testing/animate/


Code is pretty simple:


  $(document).ready( function() {
 $(#testit).click(function() {
$(#foo).SlideToggleRight(2000, foo(),


'easeboth');


return false;
 });
  });
  function foo()
  {
 $(#foo).SlideToggleRight(2000, null,


'easeboth');


 return false;
  }




Thank you in advance.


- Jim




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery GreaseMonkey-detection script modified (no remote calls)

2007-02-22 Thread Karl Swedberg

that works for me. Thanks, Kenneth!


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 23, 2007, at 1:22 AM, Kenneth wrote:


Greetings all,

I have modified the neat GreaseMonkey script by Paul Bakaus. I have  
removed the 2 remote calls made by the original script; one was for  
the the actual jQuery detection, and the other was for the jQuery  
icon.


http://kenman.net/jQuery/jquerydetector_local.user.js

Let me know if anyone has any problems running it, so far it seems  
to work fine.

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] accordion table, instead of an accordion list/menu?

2007-02-21 Thread Karl Swedberg
I haven't tested any, but there have been a few threads on this issue  
before and one workaround I recall reading about was to temporarily  
wrap a set of rows in a div before showing and hiding and then remove  
the div after the effect has completed.


If you discover this or some other method works, please post the  
solution to the list! :)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 11:25 PM, rolfsf wrote:



Is there a way around that? Can you get simple animation to work on  
table
rows? I can live with a simple show/hide, but it would be nice to  
dress it

up a little.


Karl Swedberg-2 wrote:


Rolf, I think the strange results occur in Firefox because it wants
all tr elements to have display:table-row but the .slideX()
and .show/hide(speed), etc. methods use display:block

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 9:09 PM, rolfsf wrote:



by the way, I do notice that if I use .slideToggle instead
of .toggle I get
strange results... not sure why.





--
View this message in context: http://www.nabble.com/accordion-table% 
2C-instead-of-an-accordion-list-menu--tf3264032.html#a9075220

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Loop Checkbox Action Question

2007-02-21 Thread Karl Swedberg
Actually, normal is not default for .show() and .hide() -- even  
though it is the default for all the .slideX() methods and .fadeIn 
()/.fadeOut().
Without a parameter, .show() and .hide() act differently -- just  
applying the display=none or display=block/inline to the matched set  
of elements. For them to use the animation, a parameter must be  
inlcluded.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 21, 2007, at 7:01 AM, Gorkfu wrote:



Thx, that does clean it up a lot. =)

As for normal being default for show and hide, I think the default  
doesn't

work correctly, or there is no default. Testing it blank in IE7 and
Firefox2, the checkboxes disapear faster than when set to normal  
setting.



Karl Rudd wrote:


You could combine those two and stick them both in the document HEAD,
since they both run on ready (see other email for why).

There's no need to for the filter() function in this case, the
each() function will do fine. Both iterate over the collection of
objects, but filter is meant for filtering, as in removing some
elements.

Hmmm and there's some other small optimisations. For example  
factoring

the hide/show code into it's own function. Can change
[EMAIL PROTECTED]'checkbox'] to :checkbox.

Also normal is default for show() and hide().

If I may suggest the following (untested):

$(document).ready(function(){

function visibleCheck() {
var $this = $(this);
var ul = $this.siblings(ul);
if ($this.is(:checked))
ul.hide();
else
ul.show();
}

$(:checkbox)
.click(visibleCheck)
.each(visibleCheck);
});

Karl Rudd



--
View this message in context: http://www.nabble.com/Loop-Checkbox- 
Action-Question-tf3246372.html#a9079695

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to get the ID of the parent node?

2007-02-21 Thread Karl Swedberg

Hi Dave,

A couple things:

1. since you're trying to get the ID of an ancestor of a  
class=deleteTDItem, you need to add an s to parent.

This should work:

$('#todoList a.deleteTDItem').each(function(index) {
  var divId = $(this).parents(div.sidebarToDo).attr(id);
  alert($(this).parents(div.sidebarToDo) +  id: + divId);
  $(this).click = function() { $('#' + divId).remove(); };
});

2. Initially you were trying to use the DOM property rather than the  
jQuery attribute method. That's fine. You can do it that way, but you  
first need to convert the jQuery object into a DOM node.

This should work, too:

$('#todoList a.deleteTDItem').each(function(index) {
  var divId = $(this).parents(div.sidebarToDo)[0].id
  alert($(this).parents(div.sidebarToDo)[0].id +  id: + divId);
  $(this).click = function() { $('#' + divId).remove(); };
});



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 21, 2007, at 11:16 AM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:





 ---Original Message---
 From: Chris Ovenden [EMAIL PROTECTED]
 Subject: Re: [jQuery] How to get the ID of the parent node?
 Sent: Feb 21 '07 16:04

 On 2/21/07, SAM COLLETT [LINK: mailto:[EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote: On 21/02/07, [LINK:
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]  
[LINK:
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]  
wrote:

Hi,

Following up from a question I asked yesterday, I wanted to get the
 closest parent DIV given an arbitrary nested element.  But when I  
request
 the .id of that element, i repeatedly get an undefined  
message, even
 though this call, $(this).parent( div.sidebarToDo) yields an  
object.


$('#todoList

 a.deleteTDItem').each(function(index) {

var divId =

 $(this).parent(div.sidebarToDo).id;

alert(divId);   // alwasy gives

 'undefined'

$(this).click = function() { $('#' +

 divId).remove(); };

});

This is the HTML in question:

div class=sidebarToDo width=100% id=dToDo3
table cellpadding=0 cellspacing=0 border=0 width=100%
tr
tdinput id=cbTdId3 onClick=var textDecor =  
(this.checked ?

 'line-through' : 'none');
 $('#textId3').css('text-decoration', textDecor);
 type=checkbox id=tdcb3 /td


td id=textId3 class=sidebarText style=text-decoration:

 noneStart Work/td

td align=righta class=editTDItem href='#'img

 src=images/edit.gif alt=Edit border=0/a/td

td align=righta class=deleteTDItem

 href=javascript:toggleDiv('dToDo3');img
 src=images/deleteLink.gif alt=Delete border=0/a/td

/tr
/table
/div

Thanks, - Dave


 You can get the id via attr:

 $(this).parent(div.sidebarToDo).attr(id)


 To spell it out a little more clearly, the API for attributes has  
changed

 in jQuery 1.0.3+ and shortcuts like .id() no longer work

 --
 Chris Ovenden

 [LINK: http://thepeer.blogspot.com]  http://thepeer.blogspot.com
 Imagine all the people / Sharing all the world


Thanks, but I'm still getting undefined even though I can an  
object for my reference to the DIV.  Any ideas on how to  
troubleshoot?  here's the JS:


$('#todoList a.deleteTDItem').each(function(index) {
var divId = $(this).parent 
(div.sidebarToDo).attr(id);
alert($(this).parent(div.sidebarToDo) +   
id: + divId);
$(this).click = function() { $('#' +  
divId).remove(); };

});



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] specifying count for rss feed display with each function

2007-02-21 Thread Karl Swedberg

Hi John,

It works just like a for loop. You can put the i in the anonymous  
function argument for .each(). For example:


$('p').each(function(index) {
  alert('This is paragraph number ' + index);
});

(I used index instead of i because I'm kind of dense, and it  
helps to remind me what it is).



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 21, 2007, at 3:11 PM, john smith wrote:

Sorry all Im still a newb to jquery. Ive been messing around with  
using jquery for grabbing and displaying rss feed info. A lot less  
code then using straight javascript. what Im not quite clear on is  
how you grab a specific count from doing an .each


For example if I grab a feed with the jquery code below

// count for lines display
var items_count = 10;

// feed location
var feed = my.xml';

// replace url for link
var u = 'http://www.mypage.html?txtSearch='

$(document).ready(function(){
  $.get(feed, function(xml){
  $(item, xml).each(function(){
  $(this).find(item).each(function(){
  html += ;
  }).end().find(title).each(function(){
  html += a href=' + u + this.text +  
' + this.text + /abr;

  });
  });
  $(#feed).html(html).slideDown(slow);

  });
});

Using jquery how do I do a for each count like:
for(var i=0; iitems_count; i++) {

Access over 1 million songs - Yahoo! Music Unlimited.
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sites Powered by jQuery

2007-02-20 Thread Karl Swedberg
excellent! thanks, Larry. that's sure a long list of sites to wade  
through. should be fun checking them out.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 19, 2007, at 10:41 PM, Larry Garfield wrote:


Oh yes, there's a whole forum for it: http://drupal.org/forum/25

I'm going to be relaunching a Drupal site in the next day or two  
that's an
upgrade from Drupal 4.7 to 5.  We're not doing much with jQuery  
specifically,

but, well, it's in there. :-)

On Monday 19 February 2007 8:37 pm, John Resig wrote:

Absolutely! Just like how Prototype gets more users everytime someone
uses the Ajax capabilities of Ruby on Rails. Are there any places
where new Drupal sites are listed/promoted?

--John

On 2/19/07, Larry Garfield [EMAIL PROTECTED] wrote:
Random question.  Do sites powered by a system that uses jQuery  
count?

If so, then pretty much any Drupal 5 site, for instance, counts a a
jQuery site.

On Monday 19 February 2007 5:48 pm, Rey Bango wrote:

Hey guys,

Just a reminder that we're always taking submissions for new
jQuery-powered websites. Please submit them to me or Karl Swedberg
([EMAIL PROTECTED]) and be sure to include:

- Link
- Name of Company
- What the site does
- The version of jQuery being used
- Where and how jQuery is used

For an up-to-date list, please visit:

http://docs.jquery.com/Sites_Using_jQuery

Thanks again for all of your help!

Rey...


--
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]  ICQ: 6817012

If nature has made any one thing less susceptible than all  
others of

exclusive property, it is the action of the thinking power called an
idea, which an individual may exclusively possess as long as he  
keeps it

to himself; but the moment it is divulged, it forces itself into the
possession of every one, and the receiver cannot dispossess  
himself of

it.  -- Thomas Jefferson

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


--
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called  
an idea,

which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the  
possession
of every one, and the receiver cannot dispossess himself of it.   
-- Thomas

Jefferson

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Hide/show question with dl/dt/dd - fixed!

2007-02-20 Thread Karl Swedberg

On Feb 20, 2007, at 5:09 AM, Bruce MacKay wrote:

The other approach will work when the .parent('dt') is removed, thus:

$('dt.toggle').css(cursor,pointer).bind(click, function(){$ 
(this).next('dd').slideToggle(800);return false;});


btw, unlike with the a, you don't need a return false on clicking  
the dt, because the dt doesn't have a default behavior.


I guess the only remaining question is why does the bleeding  
obvious always appear immediately after the send button on an email  
client is clicked!


Heh. When you find an answer, let me know, because it happens to me  
all the time. :)




Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com






Bruce




At 10:50 p.m. 20/02/2007, you wrote:

Hi folks,

I have a simple faq application with the question within a dt tag  
and the corresponding answer within a dd tag.


I had hoped that my onload code of:

$('dt.toggle').bind(click, function(){$(this).parent('dt').next 
('dd').slideToggle(500);return false;});


would have revealed the hidden answer until the question was clicked.

I tried wrapping the question in an a tag (with class=toggle) and  
the code:


$('a.toggle').bind(click, function(){$(this).parent('dt').next 
('dd').slideToggle(500);return false;});


but this also proved wrong.

Clearly, I don't understand something here - would someone mind  
enlightening me please?


Thanks,

Bruce

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Select elements without specific children

2007-02-20 Thread Karl Swedberg

Hi Adam,

try this:

$('li.expandable:not([a.on])')

A couple things to note:
1. you don't need to repeat li.expandable inside the :not
2. If you are using single quotation marks around the whole selector  
expression, use double quotation marks around the selector for  
the :not pseudo-class.


Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 9:19 AM, agent2026 wrote:



Hi all,

I want to select all line items without child a tags with a class  
of 'on'.


I can select the line items with the a tags:

$('li.expandable[a.on]');

But when I try :not I come up empty:

$('li.expandable:not(li.expandable[a.on])');


What am I doing wrong?

Adam
--
View this message in context: http://www.nabble.com/Select-elements- 
without-specific-children-tf3260789.html#a9062578

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] collapsible menus ~ pixel carnage

2007-02-20 Thread Karl Swedberg

Thanks again for weighing in, Sam!

Your suggestion makes more sense, since it degrades better.

Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 9:21 AM, Sam Collett wrote:


On 20/02/07, Karl Swedberg [EMAIL PROTECTED] wrote:

Ah yes, that's pretty straightforward.

One way to do this would be to put Show/Hide inside a span and
use the a for the actual link.

HTML:
ul id=Menu
   li id=current_cat
 h3spanShow/Hide/span a
href=accessories.htmAccessories/a/h3
 ul
   li sub menu links/li
   li sub menu links/li
   li sub menu links/li
   li sub menu links/li
   li sub menu links/li
 /ul
   /li
/ul


jQuery:

$(document).ready(function() {
   $('#Menu ul').hide();
   $('#Menu h3  span').click(function() {
 $(this).parent().next('ul').slideToggle('fast');
   });
});

If you want the span to be highlighted somehow on hover, see my
most recent tutorial:
http://www.learningjquery.com/2007/02/quick-tip-set-hover-class-for-
anything

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


Or if you want it to make sense when JavaScript is off, remove the
span, and add it via jQuery:

$(document).ready(function() {
  $('#Menu ul').hide();
  $('#Menu h3').prepend(a class='toggler' href='#'Show / Hide/a
).find(a.toggler).click(function() {
$(this).parent().next('ul').slideToggle('fast');
return false;
  });
});

A bit more code, but it will be styled as a link.





On Feb 20, 2007, at 2:31 AM, fatjoez wrote:



Hey.

Dont worry about my code ay.

All I'm basically asking is that in reference to the code pixel
carnage
provides as an example on his site, is it possible to modify this
so that on
the same Line as the Menu link which opens/closes a sub menu, is it
possible
also to add a LINK to an actual page also.

So that instead of it being like

[clikToToggleMenu]Menu1[/click]
sub menu link 1
sub menu link 2


INSTEAD to have it like this

[clikToToggleMenu]Show/Hide[/click]   [link]Menu1[/link]
sub menu link 1
sub menu link 2

Do you understand what I mean? So I want to have like a + / -
symbol to
expand collapse the menu and on the SAME line to have a link to
another
menu. Basically so I can show the link to the Parent category also!
--
View this message in context: http://www.nabble.com/collapsible-
menus-%7E-pixel-carnage-tf3256095.html#a9055526
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to made 'dd' hide first...

2007-02-20 Thread Karl Swedberg

Hi Rick,

Try this:

$(document).ready(function() {

  $('dd').hide()

$('dt.toggle').css(cursor,hand).bind(click, function(){

$(this).next('dd').slideToggle(800);

});

});


The initial $('dd').hide() line hides all of the dd elements when  
the DOM is ready.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 12:10 PM, Rick Faircloth wrote:


Hi, all…

When I try this…

$(document).ready(function() {

$('dt.toggle').css(cursor,hand).bind(click, function(){

$(this).next('dd').slideToggle(800);

});

});

…the ‘dd’ displays initially in the open position, then closes  
onClick.


How do I need to change the code so that the ‘dd’ displays  
initially closed?


Thanks!

Rick


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Getting parent nodes

2007-02-20 Thread Karl Swedberg

Hi Dave,
Not sure if this has been answered yet, but here is how I would do it:

$(this).parents('#inner')

Or, if you don't know what the DIV will be called, you could try it  
this way:


$(this).parents('div:eq(0)')


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 6:02 PM, [EMAIL PROTECTED] wrote:


Hi,

If I have a this.id reference to an element in my DOM, how would  
i get its parent node?


More challenging, how would I get the first DIV node that the  
element is in?  That is, it may be nested within an arbitrary  
number of table cells, but there is a DIV lurking at the top ...


div id=outer
div id=inner
table
   trtd
  table
 trtd!-- here's the element --

In the example here, I would like to get a reference to the DIV  
with ID = inner.


Thanks, you guys are the best, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Getting parent nodes

2007-02-20 Thread Karl Swedberg


On Feb 20, 2007, at 6:46 PM, Blair Mitchelmore wrote:


$(this).parent(div);

-blair


Blair,

You'll need to add an s to .parent to make that work.

$(this).parents('div');

That will work if you don't have nested DIVs.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] accordion table, instead of an accordion list/menu?

2007-02-20 Thread Karl Swedberg
Rolf, I think the strange results occur in Firefox because it wants  
all tr elements to have display:table-row but the .slideX()  
and .show/hide(speed), etc. methods use display:block


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 9:09 PM, rolfsf wrote:



by the way, I do notice that if I use .slideToggle instead  
of .toggle I get

strange results... not sure why.



Kristinn Sigmundsson wrote:


ok So something like this almost(?) does it,
$(.collapse_group[a]).click( function () {
$(this).parent().siblings(tr).slideToggle(fast, 
function() {
$(this).each( function() {
if ($(this).css(display) == block)
$(this).css(display, );
});
});
});

It is wierd though, sometimes it works and sometimes not, and when
it's not working alot of extra padding/margin is added to the bottom
of the groupelements...

I've also tried this without several tbody's (thought this might be a
incorrect markup quirk) but it's the same thing, hope that someone
could shed some light on this, got me interested :)

Oh and btw I'm using FF1.5.0.9 (it all works without problems in IE7,
no need for the display fix there)

///Kristinn




--
View this message in context: http://www.nabble.com/accordion-table% 
2C-instead-of-an-accordion-list-menu--tf3264032.html#a9074275

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Plugin updates

2007-02-19 Thread Karl Swedberg

Hi Gerry,

Thanks for the suggestion! There's a lot of activity going on in the  
[dev] and [web] lists regarding plugins. You are not alone in your  
concerns, and the dev and web teams are planning some major  
improvements to the way that plugins are presented on the site.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 19, 2007, at 7:15 AM, Gerry Tucker wrote:


Hi all,

Would it be better on the plugins page if all authors could add an  
update date so it's obvious if/when a plugin has been updated?


Currently I'm browsing all the plugins that I use on a regular  
basis to see if they have changed.


Regards,

Gerry
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Smooth Scrolling for same-page links

2007-02-19 Thread Karl Swedberg

On Feb 19, 2007, at 10:46 AM, Klaus Hartl wrote:


hcabbos schrieb:
Hey Klaus. Do you think you could post the new code that includes  
everyone's

final recommendations?


I think that is already the code I posted, I took Sam's improvements
into account already... Karl?


-- Klaus


Yep, that was it. :)

Here it is once more for good measure:


$('[EMAIL PROTECTED]#]').click(function() {
   if (location.pathname == this.pathname  location.host ==  
this.host) {

 var target = $(this.hash);
 target = target.size()  target || $([EMAIL PROTECTED] +
this.hash.slice(1) +']');

 if (target.size()) {
 target.ScrollTo(400);
 return false;
 }
});



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Id of a textarea element

2007-02-19 Thread Karl Swedberg

 And: If it were a bug in jQuery, it would be a bug in every known CSS
 parser that exists out there. Because the CSS selector

 div#identifier.classification

 Sorry. I didn't know this was a valid selector.
 I though the . had to be preceded with a space or a tagname.

 would only select the following element:

 div id=identifier class=classification


 -- Klaus


Of course, the CSS parser for IE 6 has a terrible time dealing with  
references to #id.class {} and .class1.class2 {}.
It ignores #id and .class1

cf. http://www.quirksmode.org/css/multipleclasses.html


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Smooth Scrolling for same-page links

2007-02-18 Thread Karl Swedberg

On Feb 18, 2007, at 5:51 AM, Sam Collett wrote:

Are you aware of the pathname and host properties? If you use it, you
can cut down the code further:

$('[EMAIL PROTECTED]#]').click(function() {
  if (location.pathname == this.pathname  location.host ==  
this.host) {

if ($(this.hash).length  0 ) {
  $(this.hash).ScrollTo(400);
  return false;
} else {
  $linkDest = $([EMAIL PROTECTED] + this.hash.slice(1) +']');
  if ($linkDest.length  0) {
$linkDest.ScrollTo(400);
return false;
  }
}
  }
});



Ah! That is beautiful, Sam! Thanks!

You know, sometimes I make things much harder for myself than they  
have to be, just because I fear the browser (IE in particular)  
inconsistencies. So, instead of using a few simple, built-in  
JavaScript properties, I use the one I know works and slice it up the  
hard way.


Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Smooth Scrolling for same-page links

2007-02-18 Thread Karl Swedberg

Even better! Thanks, Klaus!


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 18, 2007, at 10:05 AM, Klaus Hartl wrote:




Are you aware of the pathname and host properties? If you use it, you
can cut down the code further:

$('[EMAIL PROTECTED]#]').click(function() {
  if (location.pathname == this.pathname  location.host ==  
this.host) {

if ($(this.hash).length  0 ) {
  $(this.hash).ScrollTo(400);
  return false;
} else {
  $linkDest = $([EMAIL PROTECTED] + this.hash.slice(1) +']');
  if ($linkDest.length  0) {
$linkDest.ScrollTo(400);
return false;
  }
}
  }
});



Avoid some duplicate code here!


$('[EMAIL PROTECTED]#]').click(function() {
   if (location.pathname == this.pathname  location.host ==  
this.host) {

 var target = $(this.hash);
 target = target.size()  target || $([EMAIL PROTECTED] +
this.hash.slice(1) +']');

 if (target.size()) {
 target.ScrollTo(400);
 return false;
 }
});


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Powered Sites - Keep the Links Coming

2007-02-17 Thread Karl Swedberg

On Feb 17, 2007, at 8:46 AM, Joel Birch wrote:


Thanks Rick, all credit for the smooth scroll goes to Stefan Petre,
of course. I like using it over a regular in-page link because it
gives the user a sense of how they got there rather than a
disorienting sudden change. Glad you like the site Rick.

Joel.


I love this smooth scroll, too, and have used it on a few of my own  
sites. (Thanks, Stefan!) It's one of those effects that is more than  
just eye candy.


I'd love to hear Klaus's take on this, or any other usability guru  
out there, but to me the smooth scroll seems much better than the  
default quick jump because of the disorienting sudden change that  
you mention.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Powered Sites - Keep the Links Coming

2007-02-17 Thread Karl Swedberg

On Feb 17, 2007, at 10:22 AM, Joel Birch wrote:

My thoughts exactly Karl.

On another note, I just created a simple plugin (my first ever!) that
I have applied to the Preshil site and may ask for feedback tomorrow
if it still seems like a good idea after a good night's sleep (its
late here). It creates a menu of in-page links out of whatever query
you supply as a parameter, within the jQuery elements you chain the
plugin to. Easier to show an example...

Example usage:
$(#content).contentMenu(h2);


Ha! Now you are scaring me!   :) That's exactly what I've done on  
learningjquery.com! (You're not reading my mind, are you?)


Well, I didn't convert it into a plugin, but I did add page-content  
links using jQuery. I've been meaning to write up a little tutorial  
on how I did it, but haven't gotten around to it yet. For my site, it  
looks through the main content area to see if there is more than one  
h2 element. If so, it builds a page-content list based on those,  
and links to each one. If not, it tries to find more than one h4  
element (which is what I use for the tutorial subheadings) and uses  
those for its page contents.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Powered Sites - Keep the Links Coming

2007-02-17 Thread Karl Swedberg

Hey Toby,

Nice site!

I wrote an entry on Learning jQuery about blurring links:
http://www.learningjquery.com/2006/10/quick-tip-blur-links

Hope that helps.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 17, 2007, at 12:15 PM, Toby wrote:

I really like the way it works too, and it falls back fine easily  
with no JS.




Any way of tweaking the tween/animation/scroll so it eases in/out?



Here’s my newbie jQuery site  www.tobybrancher.net it’s the first  
time I have used it and definitely needs some work (been reading up  
on the href comments made here although nothing yet about clearing  
the focus).




Nice1 again!

Toby



From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On Behalf Of Rick Faircloth

Sent: 17 February 2007 16:42
To: 'jQuery Discussion.'
Subject: Re: [jQuery] jQuery Powered Sites - Keep the Links Coming



Ø   seems much better than the default quick jump

Ø   because of the disorienting sudden change that you mention.



Absolutely true, Karl.  The biggest problem with those new to the  
Internet


(and, yes, there are such people still around) is the “jumping  
around”… between


pages, from one part of the page to the other with anchors, etc.  I  
remember


the first time I used the Internet…my initial response was that it  
was “very”


disconcerting...one click and instantly everything on the screen  
was changed,


especially with an anchor.



It took awhile to get used to the freedom to move virtually  
anywhere on the ‘Net


in an instant.  The smooth scroll effect will make anchors usable  
for me.  Smooth


changes in page content or orientation help people know where they  
are in relation


to where they’ve been.



Rick



From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On Behalf Of Karl Swedberg

Sent: Saturday, February 17, 2007 9:55 AM
To: jQuery Discussion.
Subject: Re: [jQuery] jQuery Powered Sites - Keep the Links Coming



On Feb 17, 2007, at 8:46 AM, Joel Birch wrote:




Thanks Rick, all credit for the smooth scroll goes to Stefan Petre,
of course. I like using it over a regular in-page link because it
gives the user a sense of how they got there rather than a
disorienting sudden change. Glad you like the site Rick.

Joel.


I love this smooth scroll, too, and have used it on a few of my own  
sites. (Thanks, Stefan!) It's one of those effects that is more  
than just eye candy.




I'd love to hear Klaus's take on this, or any other usability guru  
out there, but to me the smooth scroll seems much better than the  
default quick jump because of the disorienting sudden change  
that you mention.






--Karl

_

Karl Swedberg

www.englishrules.com

www.learningjquery.com





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Smooth Scrolling for same-page links

2007-02-17 Thread Karl Swedberg
ok, now that the smooth scrolling has Klaus's blessing :) ... I  
thought I'd share some code I wrote to make it happen for all same- 
page links. It takes into account the difference in the way the  
various browsers treat href.


Oh yeah, now that Brandon has fixed that for .attr('href') in the  
latest SVN, the code could be shortened a great deal. Unfortunately,  
I don't have time just now to do that, so here is the old code, which  
won't break anything with latest SVN, and will also make things work  
in older jQuery versions (the Interface ScrollTo plugin is required):


  var docHashIndex = location.href.indexOf(#);
  if (docHashIndex != -1) {
var docURL = location.href.slice(0,docHashIndex);
  }
  else {
var docURL = location.href;
  }

  $('[EMAIL PROTECTED]#]').click(function() {
var $linkHref = $(this).href();
var linkHashIndex = $linkHref.indexOf('#');
var linkURL = $linkHref.slice(0,linkHashIndex);
var linkHash = $linkHref.slice(linkHashIndex);

if (docURL == linkURL) {
  if ($(linkHash).length  0 ) {
$(linkHash).ScrollTo(400);
return false;
  } else {
$linkDest = $([EMAIL PROTECTED] + linkHash.slice(1) +']');
if ($linkDest.length  0) {
  $linkDest.ScrollTo(400);
  return false;
}
  }
}
  });

Hope that's helpful to someone.

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Smooth Scrolling for same-page links

2007-02-17 Thread Karl Swedberg
On Feb 17, 2007, at 4:36 PM, Joel Birch wrote:

 On 18/02/2007, at 6:13 AM, Karl Swedberg wrote:
 ok, now that the smooth scrolling has Klaus's blessing :) ... I
 thought I'd share some code I wrote to make it happen for all same-
 page links. It takes into account the difference in the way the
 various browsers treat href.

 Thanks for sharing that code Karl.
 Okay, that has me worried that my solution (which I thought worked
 perfectly) may be flawed in ways I was not aware of. Here is the code
 I am using to attach the scrollTo plugin to elements that have a
 class of scrolls:

 (function($){
   $.fn.scrollToHash = function(){
   return this.each(function(){
   $(this).click(function(){
   $(this.hash).ScrollTo(1500,'easeout')[0].blur();
   return false;
   });
   });
   };
 )(jQuery);

 $(function(){
   $(a.scrolls).scrollToHash();
 });

 Karl, I'm sure there must be issues I am not aware of here. Can you
 or anyone point them out for me? This code seems to work in all the
 browsers I have tested including IE6 and IE7, it's the exact code I
 am using on Preshil, but maybe I am overlooking something.
 Thanks.

 Joel.

Hey Joel,

By using this.hash and limiting it to links with the scrolls class,  
you seem to have things covered.

I put my solution together for a content-managed site in which pages  
are being created and updated by people with very limited (okay, non- 
existent) HTML skills. I couldn't expect them to  know what they were  
doing, let alone add a class to the links. Therefore, I had to  
consider the following:

1. Links to other pages might have the hash as well. Only the ones to  
the same page should use ScrollTo()
2. The links could be going to an element with id=something or to  
an anchor with only name=something

As Klaus mentioned, I probably could have simplified things a bit by  
using this.hash. But because I had to account for other things that  
the editors might do, I had to make the code a bit more complex  
than yours. If I could have made them add a class to their same-page  
links, that would have cut down my code significantly, and it would  
have looked more like yours.

I hope that makes sense. I'm typing this while away from home, so my  
mind isn't totally here. :)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Question about .each()

2007-02-15 Thread Karl Swedberg
Ahh, I just noticed you'll need to move the semicolon outside the  
alert, too. Instead of...

$(this).click(function(){ alert(this.id;) });


do this...

$(this).click(function(){ alert(this.id); });




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 15, 2007, at 8:20 AM, Karl Swedberg wrote:


Hi Chris,

When you chain jQuery methods to this, you need to encapsulate  
this in the jQuery constructor -- $(). Try it this way, and see  
if it works:


$(.MyButton).each(function(){

$(this).click(function(){ alert(this.id;) });

});


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 15, 2007, at 8:14 AM, Mahadewa wrote:



Hi all,

I have a question about .each construct.  I have the following  
snippet code,
but for some reason it doesn't do what I expected it to do.  Have  
I missed

something ?

$(.MyButton).each(function(){

this.click(function(){ alert(this.id;) });

});

Thanks for the help,
Chris
--
View this message in context: http://www.nabble.com/Question- 
about-.each%28%29-tf3233682.html#a8985143

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] getting children using XPath in IE

2007-02-15 Thread Karl Swedberg

Hi Matthew,

Not sure, haven't tried this, but the problem might be that you have  
two slashes before xmlelement. Is xmlelement the document root? If  
so, try it with only one beginning slash:


$(/xmlelement)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 15, 2007, at 8:21 AM, Matthew Delmarter wrote:

Maybe this is just not possible in jQuery yet? I find it strange  
how it works fine in Firefox, but not IE7 though.




Am I iterating incorrectly? Is there another method I should be  
using? I have tried a number of different methods but simply cannot  
get IE to give me a list of child nodes that I can iterate thru.




Any help appreciated … I am about to give up on Xpath in jQuery  
otherwise.




Regards,

Matthew





From: [EMAIL PROTECTED] [mailto:discuss- 
[EMAIL PROTECTED] On Behalf Of Matthew Delmarter

Sent: Thursday, 15 February 2007 6:51 p.m.
To: jQuery Discussion.
Subject: [jQuery] getting children using XPath in IE



Hi all,



I am getting quite confused here with trying to use XML/Xpath in IE.



Let’s imagine that I have the following XML in my page:



  xmlelement

  subelement1/subelement1

  subelement2/subelement2

  subelement3/subelement3

  subelement4/subelement4

  /xmlelement



How do I traverse through all the children of “xmlelement”?



In Firefox this works fine:



  $(//xmlelement).children().each(function(e)

  {

  alert(hi)

  })



In Internet Explorer (I am using ver 7) I get nothing at all.



Any clues much appreciated…





Matthew Delmarter



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Parent Selection Problem

2007-02-15 Thread Karl Swedberg

On Feb 15, 2007, at 11:01 AM, Mahadewa wrote:

// This function is wired to the above buttons' onclick event,  
passing

'this' as an argument
function OnButtonClick(source)
{
var parent = $(.parent).children(source.id);
}


Hi Chris,

 you should be able to do it this way:

var parent = $(this).parents('div.parent');



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 15, 2007, at 11:01 AM, Mahadewa wrote:



Hi all,

I've got the following problem ...

Let's say I have the following html:

div class=parent id=parent1
div class=sub
input id=parent1_Button class=mybutton type=button
value=button /
/div
/div
div class=parent id=parent2
div class=sub
input id=parent2_Button class=mybutton type=button
value=button /
/div
/div

Now given a JQuery object of any of the button, how can I select  
its parent

div (the one with the class parent) ?

I have tried the following, but it doesn't seem to yield the  
correct object:


// This function is wired to the above buttons' onclick event,  
passing

'this' as an argument
function OnButtonClick(source)
{
var parent = $(.parent).children(source.id);
}

Thanks a lot !
Chris
--
View this message in context: http://www.nabble.com/Parent- 
Selection-Problem-tf3234532.html#a8987992

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Parent Selection Problem

2007-02-15 Thread Karl Swedberg

Are you sure? Maybe the problem is with source.id

I put your HTML into a page and ran this code (on document ready):

$('input').click(function() {
  var parentId = $(this).parents('div.parent')[0].id;
  alert(parentId);
});

When I clicked the first button, the alert read parent1
When I clicked the second, the alert read parent2

If that isn't what you're expecting, maybe I'm misunderstanding what  
you're trying to do.



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 15, 2007, at 12:02 PM, Mahadewa wrote:



This doesn't do it for me.  I got the Button itself as a result.

var parent = $(this).parents('div.parent');

Is this not the same as to say: Select element (of 'this') which  
parent is

'div.parent'  ?

I think I need the other-way around, don't I ?
Something like ... Get me the element, which class is 'parent',  
which has

'this' children.

Chris


Karl Swedberg-2 wrote:


On Feb 15, 2007, at 11:01 AM, Mahadewa wrote:


// This function is wired to the above buttons' onclick event,
passing
'this' as an argument
function OnButtonClick(source)
{
var parent = $(.parent).children(source.id);
}


Hi Chris,

  you should be able to do it this way:

var parent = $(this).parents('div.parent');



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 15, 2007, at 11:01 AM, Mahadewa wrote:



Hi all,

I've got the following problem ...

Let's say I have the following html:

div class=parent id=parent1
div class=sub
input id=parent1_Button class=mybutton  
type=button

value=button /
/div
/div
div class=parent id=parent2
div class=sub
input id=parent2_Button class=mybutton  
type=button

value=button /
/div
/div

Now given a JQuery object of any of the button, how can I select
its parent
div (the one with the class parent) ?

I have tried the following, but it doesn't seem to yield the
correct object:

// This function is wired to the above buttons' onclick event,
passing
'this' as an argument
function OnButtonClick(source)
{
var parent = $(.parent).children(source.id);
}

Thanks a lot !
Chris
--
View this message in context: http://www.nabble.com/Parent-
Selection-Problem-tf3234532.html#a8987992
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
View this message in context: http://www.nabble.com/Parent- 
Selection-Problem-tf3234532.html#a8989357

Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] animate only work at the first time?

2007-02-14 Thread Karl Swedberg

Hi Howard,

Not sure if this will solve your problem, but opacity values range  
from 0 to 1, not 0 to 100. Try changing the value of your second  
opacity to .999 or 1.0 and see if that works for you.


Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 14, 2007, at 11:37 AM, howard chen wrote:

div id=test style=width: 200px; height: 200px; background- 
color: blue;

test
/div


a href=# onclick='$(#test).animate( {opacity : 0} );'hide/a
a href=# onclick='$(#test).animate( {opacity : 100} );'show/a


only the first link show the correct animationsecond link will
failed if you click the first link first.

it can show up, but not an animation anyway

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] get nth item with jquery still usable - not get()

2007-02-14 Thread Karl Swedberg

hi Matthew,

there are a few ways to do this. Let's say, for example, you're  
trying to get the 4th div with class=myclass:


$('div.myclass:eq(3)')

$('div.myclass:nth(3)')

$('div.myclass').eq(3)

All of those would do it.

Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 14, 2007, at 9:58 PM, Matthew Delmarter wrote:


Hi all,

I am trying to get to the nth item in an array of results - while  
still

being able to use jQuery on the object.

I am quite familiar with using get(n) - which returns the DOM  
object. I want

the equivalent for jQuery.

Any tips much appreciated - getting lost in the docs here and I am  
sure

there must be an easy way to do this?

Does this all make sense?

___
Matthew Delmarter




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Which file to download from SVN?

2007-02-13 Thread Karl Swedberg

Hi Seb,

If you want to do an SVN checkout, the instructions at http:// 
docs.jquery.com/Downloading_jQuery should help.


If you just want to quickly grab a file, feel free to take one of the  
flavors on my test server.
They are all Rev 1316 from 2/9/07, and they should have the flicker  
fix in them:


http://test.learningjquery.com/scripts/jquery.js
http://test.learningjquery.com/scripts/jquery.lite.js
http://test.learningjquery.com/scripts/jquery.pack.js

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 13, 2007, at 7:16 AM, Seb Duggan wrote:


OK, I'm not very well up on SVN...

I've read that the latest build on SVN might fix the problem of
flickering in FF Mac, so thought I'd download it to test...

Which file/branch/etc. should I be trying?


Seb


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Some jQuery tips and tricks

2007-02-13 Thread Karl Swedberg

On Feb 13, 2007, at 11:22 AM, R. Rajesh Jeba Anbiah wrote:


For #1, what about:
$(document).ready(function() {
$(#wrapper p).hide(); //hide initially
$(#wrapper h2).click (function() {
$(p, $(this).parent()).slideToggle(slow);
});
});


Looks good to me. Also, instead of this...

$(p, $(this).parent()).slideToggle(slow);


...you could do this:
  $(this).siblings('p').slideToggle('slow');

If you still want to add all the css stuff in the jQuery code (I  
usually prefer adding and removing classes), you can do that in the  
same line by using the .filter() method:


$(document).ready(function() {
  $('#wrapper p').hide()
  $('#wrapper h2').filter(':even').css('backgroundColor',  
'#ef').end().filter(':odd').css('backgroundColor', '#ef').end 
().css({cursor: 'hand', cursor: 'pointer', color: '#fff'}).click 
(function() {  $(this).siblings('p').slideToggle('slow');  });

});

Or, to make it more readable:

$(document).ready(function() {
  $('#wrapper p').hide()
  $('#wrapper h2')
  .filter(':even')
.css('backgroundColor', '#ef')
  .end()
  .filter(':odd')
.css('backgroundColor', '#ef')
  .end()
  .css({cursor: 'hand', cursor: 'pointer', color: '#fff'})
  .click(function() {
$(this).siblings('p').slideToggle('slow');
  });
});


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com






On Feb 13, 2:23 pm, Dmitrii Dimandt [EMAIL PROTECTED] wrote:

I've started collecting some examples I've come across while solving
problems using jQuery. I guess they could be interesting to the
community as a whole.

These (sort of) tricks are available here:http://dmitriid.com/ 
jquery/en/

  snip



--
  ?php echo 'Just another PHP saint'; ?
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Design Decisions? Comparison to MooTools?

2007-02-13 Thread Karl Swedberg

On Feb 13, 2007, at 4:25 PM, Dave Methvin wrote:

Just discovered your use unary operator tip
(http://www.javascripttoolbox.com/bestpractices/#plus).
Great! Much more succinct then a parseInt(value).


Be very careful using the + operator this way.

 +32px returns NaN
 parseInt(32px) returns 32




Heh. I was wondering about that. You saved me the trouble of having  
to test it. :)


Cheers,
--Karl

_
Karl Swedberg
www.englishrules.com
www.learningjquery.com




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to animate background-color ?

2007-02-12 Thread Karl Swedberg

Hi there Chris,

Only a subset of CSS properties are able to be animated with the  
jQuery core alone. For extended animation support, check out the  
Interface plugin. Here is a link to documentation on animate:

http://interface.eyecon.ro/docs/animate

And here is a snippet of code that gives you an idea of what you can  
do with it:

$('#test').animate(
{
left: 100,
style: 'padding: 20px 30px; margin: 10px;',
className: 'greenBorders',
opacity: 0.4,
backgroundColor: 'olive'
},
'slow'
);


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 9, 2007, at 5:37 AM, Mahadewa wrote:



Hi guys,

I was wondering if anybody could help with this.  I am trying to do  
animate
on the backgound-color of a div, but I got an error message saying  
that

'background-color' is not supported.

Here is my code:

$(#testanimate).mouseover(function(){
$(this).animate({'background- 
color':'#ff'},slow);

});

Is this the correct way of doing it ? Have I missed something ?

Thanks for the help,
Chris
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Site using jQuery

2007-02-12 Thread Karl Swedberg
Right on the home page, looks like they've got some nice jQuery tabs  
going (TurboTax, QuickBooks, Quicken) and there's a Quick Links  
slideDown() at the top. Very cool, Glen! Glad to see it up there.


Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 12, 2007, at 7:14 PM, Rey Bango wrote:


Very sweet. Which sections are using jQuery Glenn?

Rey

Glen Lipka wrote:

It's live finally.
http://www.intuit.com

Very jQuery.



- 
---


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] toggle(fn, fn) does not execute

2007-02-11 Thread Karl Swedberg

Hi there Δημήτρης,

The two .toggle() methods are very different (and, therefore, often  
confusing to new users of jQuery):


The first one toggles the show and hide effects: for example,
   .toggle('slow')
The second one is a compound event handler that triggers 2  
alternating functions: for example,

  .toggle(function() {
// Stuff to do every *odd* time the element is clicked;
  }, function() {
// Stuff to do every *even* time the element is clicked;
  });

It looks like you're trying to trigger an even handler inside an  
event handler?


Please try this instead:

$(function(){
   $('.desc span:first-child').toggle(function() {
 $(this).next().hide();
   }, function() {
 $(this).next().show();
   });
});

If all you are doing is hiding and showing the next sibling element,  
though, you could do the same thing this way:


$(function(){
  $('.desc span:first-child').bind('click', function() {
$(this).next().toggle();
  });
});

Hope that helps.

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 11, 2007, at 8:02 AM, Δημήτρης Χρυσομάλλης  
wrote:



Hello,
I am new to jquery and I am having a problem with toggle( fn, fn).  
The code below does not seem to work (no errors though). But if I  
call toggle() with no arguments, it works fine. The thing is, I  
need to do different things on each click. Might this be a bug?


script type=text/javascript
$(function(){
 $('.desc span:first-child')
 .bind(click, function(){
 $(this)
 .next()
 .toggle( function(){ $(this).hide(); },
 function(){ $(this).show(); } );
 });
});
/script

I am using it with this markup:

div class=row
 div class=cell  desc id=s_desc
  span id=s_desc_captiondescription:/span
  span id=s_desc_contentlorem ipsum.../span
 /div
/div

Thank you.
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery for President

2007-02-11 Thread Karl Swedberg

Well, there you go! :)

Looks like the developer did a copy/paste job -- unless Nick Rigby  
actually designed the Barack Obama site.


Thanks for the link, Jörn. Helps to explain some of the JS- 
gymnastics. The comments are especially interesting.


Cheers,
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 11, 2007, at 9:13 AM, Jörn Zaefferer wrote:


Karl Swedberg schrieb:

On Feb 10, 2007, at 7:42 PM, Glen Lipka wrote:


*http://www.barackobama.com** (jQuery!)*
/Although they are using 1.04.  Hello?  I was all on board until I
saw they haven't upgraded.  Wassup widdat?
//Is the developer for this site on the list?/


Hmmm. Maybe the developer is just getting started with jQuery...

http://www.barackobama.com/js/cmxform.js:

See http://alistapart.com/articles/prettyaccessibleforms

--
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Checking for a class?

2007-02-11 Thread Karl Swedberg
You could also use one of the attribute selectors to filter a set of  
matched elements. If you don't care where the particular value  
appears within the class attribute, you could do this:


$('[EMAIL PROTECTED]')


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 11, 2007, at 2:16 PM, Brandon Aaron wrote:


You can use the .is() method to check if an element has a particular
class like this.

$('#id').is('.someClass');

It will return true if it has that particular class and false if it  
doesn't.


The .is() method can also be used to check other things as well. Here
are the docs for the method.
http://jquery.bassistance.de/api-browser/#isString

--
Brandon Aaron

On 2/11/07, Tom Holder [EMAIL PROTECTED] wrote:
How can I check to see if there is a particular css class on an  
element?


Presumably I could just do $(#id).attr(class); but I'm doing  
it in a
loop where the class names have multiple classes on them and I  
only want to
check for a specific one. Bith loathed to write a regexp for  
something so

simple.

Cheers
Tom
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Checking for a class?

2007-02-11 Thread Karl Swedberg

D'oh! Why not indeed!
slap my forehead/

Thanks, Christof. :)

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 11, 2007, at 3:22 PM, Christof Donat wrote:


Hi,


You could also use one of the attribute selectors to filter a set of
matched elements. If you don't care where the particular value
appears within the class attribute, you could do this:

$('[EMAIL PROTECTED]')


Why not simply this
$('#id.someClass')

Christof

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Want to know if sites are jQuery powered? Check this out!

2007-02-10 Thread Karl Swedberg

Hey Paul,

This is a really cool little user script. Unfortunately, it doesn't  
seem to be working anymore for me, now that I installed the new  
version. Not sure what might be causing the problem, since I never  
looked at the code of the first version and don't having anything to  
compare. Any ideas?




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 10, 2007, at 9:18 AM, Paul Bakaus wrote:


Hi all,

thanks for your great feedback! To answer a few things:

To get around any diversion of $, perhaps you should use jQuery in
place of $ (?) - Done

I just loaded an XML page and it caused an error to show up in  
FireBug.  I
tracked it down easily and found that the following code should  
solve the
problem.  The script assumed that there would always be a 'head'  
element in
a file, this fixes that issue. - Done (you have to reinstall it  
for this)


Now to you Rey: Yes, actually it was using the jQuery badge before,
which is more prominent, but talking to John, we changed it so it
would not interfere with the site itself.

The reason why I'm including another remote script, is that
greasemonkey scripts rin in a very strict sandbox, in which I cannot
check wether jQuery exists or not. The first thing to solve that, was
iterating over the script tags and then match the keyword 'jquery',
but Technorati for example names it's library base.js. This way, it
will certainly find jQ if it is available.

Rey, you could always write a couple of lines how you want your plug
to be, then sent it to me and I will create a customized version, else
if you only want to use it yourself, just look at
jquerydetector.user.js and change the path to a file you wrote.

So far,

Paul



2007/2/9, Franck Marcia [EMAIL PROTECTED]:

2007/2/9, Paul Bakaus [EMAIL PROTECTED]:

I have set up a easy but useful greasemonkey script, which adds a
small jquery icon in the bottom right corner if jQuery is found.



Paul,

To get around any diversion of $, perhaps you should use jQuery in
place of $ (?)

Franck.

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
--
Paul Bakaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery for President

2007-02-10 Thread Karl Swedberg

On Feb 10, 2007, at 7:42 PM, Glen Lipka wrote:


http://www.barackobama.com (jQuery!)
Although they are using 1.04.  Hello?  I was all on board until I  
saw they haven't upgraded.  Wassup widdat?

Is the developer for this site on the list?


Hmmm. Maybe the developer is just getting started with jQuery...

http://www.barackobama.com/js/cmxform.js:
if( document.addEventListener ) document.addEventListener 
( 'DOMContentLoaded', cmxform, false );


function cmxform(){
  // Hide forms
  $( 'form.cmxform' ).hide().end();

  // Processing
  $( 'form.cmxform' ).find( 'li/label' ).not( '.nocmx' ).each 
( function( i ){

var labelContent = this.innerHTML;
var labelWidth = document.defaultView.getComputedStyle( this,  
'' ).getPropertyValue( 'width' );

var labelSpan = document.createElement( 'span' );
labelSpan.style.display = 'block';
labelSpan.style.width = labelWidth;
labelSpan.innerHTML = labelContent;
this.style.display = '-moz-inline-box';
this.innerHTML = null;
this.appendChild( labelSpan );
  } ).end();

  // Show forms
  $( 'form.cmxform' ).show().end();
}


Could be done like this...

$(document).ready(function() {
  $('form.cmxform li/label').not('.nocmx').each(function(index) {
var labelContent = $(this).html();
var labelWidth = $(this).width();
$(this).empty();
$('span/span').html(labelContent).css({display: 'block',  
width: labelWidth}).appendTo(this);

  });
});

But why would someone need to append a span to the label instead of  
just styling the label?
And why would someone want to use a span and then make it  
display:block instead of just using a div ?


Maybe I'm missing something?


in jQuery we trust.


Yes, but some trust it more than others. :)

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Highlight Vertical Table Cells

2007-02-09 Thread Karl Swedberg
This works for the thead. You can apply the same principle to the  
tfoot:


$('th').each(function(index) {
  $(this).hover(function() {
$('td:nth-child(' + (index+1) +')').css('background', '#ffc');
  }, function() {
$('td:nth-child(' + (index+1) +')').css('background', '#fff');
  });
});

I only used .css() to run a quick test. You'll probably want to  
change those two to .addClass('some-class') and .removeClass('some- 
class')



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 9, 2007, at 8:27 AM, Mark Harwood wrote:


Im trying to figure out how i could go about highlighting table cells
that are grouped vertically when you hover over the THEAD element  
or the

TFOOT element.

Im not sure how i should grab them via jQuery though.

Say we have a table like

table
thead
tr
thPeople/th --// Hove over this //-
thAges/th
thEmail/th
/tr
/thead
tbody
tr
tdJohn/td --// Highlight this //-
td68/td
tdnone/td
/tr
tr
tdJoe/td --// Highlight this //-
td99/td
tdnone/td
/tr
tr
tdMary/td --// Highlight this //-
td72/td
tdnone/td
/tr
/tbody
/table

Any ideas? it would need to select all the TD directly below it, or
above it if we was highlighting a TFOOT element



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problem with [EMAIL PROTECTED]

2007-02-09 Thread Karl Swedberg

That's great news, Brandon! Thanks!

Was this a post-1.1.1 fix?


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 9, 2007, at 10:03 AM, Brandon Aaron wrote:


We just fixed this for the href attribute. Is IE actually returning
the whole URL? Are there other attributes that IE doesn't return what
is actually there?

--
Brandon Aaron

On 2/9/07, Dave Methvin [EMAIL PROTECTED] wrote:



   switch($(this).attr(src)) {
   case '1.gif':


That definitely won't work in IE, because IE gives you the whole URL
including http:// and domain. You'll need to strip that off before  
your

switch.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Highlight Vertical Table Cells

2007-02-09 Thread Karl Swedberg
If there are multiple values for the attribute, then [EMAIL PROTECTED]  
will be too specific, since it's looking for /exact/ matches.


Try this instead:

[EMAIL PROTECTED]

That's get the elements in which the headers attribute /contains/ foo.

Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 9, 2007, at 11:08 AM, Mark Harwood wrote:


http://dev.acornpartner.com/test.php

As you can see it almost works, im still struggling on matching
[EMAIL PROTECTED] which have multiple header values.

Also is there anyway of reducing the amount of flickering in IE? or is
this just something that we will have to put up with?

Cheers
Mark

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


  1   2   3   4   >