Never satisfied until I test something I set up your code here with my
modifications.  

 

http://brilliantlemming.com/test/andy.html

 

Have a look at the source.  

 

There was one error in my if statement.. It should have read:

 

if(curImg.attr("src").indexOf('tri_open') == -1){ 

 

Cheers,                   

David Dexter   |  brilliantlemming.com  |  Brentwood, CA  |  310.414.0949

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of David Dexter
Sent: Thursday, March 29, 2007 8:58 AM
To: 'jQuery Discussion'
Subject: Re: [jQuery] CODE REVIEW: the fruits of today's labor
-nowwithREALCODE!

 

Andy,

 

I'd do something like this...

 

$(document).ready( function(){

          $('.row td img.open').bind("click", function() {

                   var curImg = $(this);

                   var id = curImg.parent().parent().attr("id");

                   var idArr = id.split("-");

                   var child = $('#' + id + '-details');

          // I'd do a simple check to see if the image you just clicked has
a src that includes "tri_open"

          // If it doesn't run your open stuff 

                   if(curImg.attr("src").indexOf('tri_open' == -1){ 

                             curImg.attr("src","images/loader.gif");

                             $('.hidden:visible').slideUp("fast");

 
$('[EMAIL PROTECTED]/tri_open.gif]').attr("src","images/tri_closed.gif");

                             $.get("ajax3.cfm",
{method:idArr[0],key:idArr[1]}, function(data){

 
curImg.attr("src","images/tri_open.gif");

                                      child.html(data).slideToggle("fast");

                             });

                   }else{

          // If it does close it up.

                             curImg.attr("src","images/loader.gif");

                             child.slideUp('fast',function(){

 
curImg.attr("src","images/tri_closed.gif");

 
});

                   }

          });

});

David Dexter   |  brilliantlemming.com  |  Brentwood, CA  |  310.414.0949

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Thursday, March 29, 2007 8:32 AM
To: 'jQuery Discussion'
Subject: Re: [jQuery] CODE REVIEW: the fruits of today's labor -
nowwithREALCODE!

 

Well, technically that's already there, but because of the way that I'm
detecting "open" rows, if you click on a row that's already open, it has
some weirdness to it. I'm going to change some of that out today.

 

 

 

 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of David Dexter
Sent: Thursday, March 29, 2007 9:26 AM
To: 'jQuery Discussion'
Subject: Re: [jQuery] CODE REVIEW: the fruits of today's labor - now
withREALCODE!

I would definitely consider adding close functionality to a menu that is
already expanded. That way if a user clicks an arrow in the down state the
row would collapse and the arrow would then point back to the right.

David Dexter   |  brilliantlemming.com  |  Brentwood, CA  |  310.414.0949

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Thursday, March 29, 2007 6:12 AM
To: 'jQuery Discussion'
Subject: [jQuery] CODE REVIEW: the fruits of today's labor - now with
REALCODE!

 

Sorry guys...I tried posting the code last night using the Google Groups
interface, but it didn't come through.

 

Here you go:

http://www.commadelimited.com/uploads/psychic

 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Wednesday, March 28, 2007 4:59 PM
To: [jQuery]
Subject: [jQuery] CODE REVIEW: the fruits of today's labor

Okay...

 

I finished my proof of concept for the project I've got. It works just as I
want it to in IE6, IE7 and FF2. I wondered if you guys would mind testing it
in whatever browsers you have as well as taking a look at the jQ code and
telling me where I might be able to thin things out a bit.

 

Please don't hesitate to offer any criticism, critiques or suggestions. I'd
love to know where I could improve this code, or if I'm doing anything
"wrong".

 

Anyone out there that's wanting to do the same thing, feel free to snake
this code. It's all yours.

____________________________________

 

Andy Matthews
Senior Coldfusion Developer

Office:  877.707.5467 x747
Direct:  615.627.9747
Fax:  615.467.6249

[EMAIL PROTECTED]
www.dealerskins.com <http://www.dealerskins.com/> 

 

Attachment: image001.gif
Description: GIF image

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

Reply via email to