[jQuery] Re: A better way of writing this code?

2009-05-15 Thread Pappy
While $("li a").hover(function(){ $(this).addClass("move"); }, function() { $(this).removeClass("move"); }); works well in theory, I've found that $("li a").hover(function(){ $("li a").removeClass("move"); $(this).a

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread benoit v.
what about that ? $("li a").hover(function(){ $(this).toggleClass("move"); }); On May 15, 4:42 pm, Jthomas wrote: > Hi Calvin, > I think what you're looking for is something like this, as James said. > >         $("li a").hover(function(){ >                 $(t

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread Jthomas
Hi Calvin, I think what you're looking for is something like this, as James said. $("li a").hover(function(){ $(this).addClass("move"); }, function() { $(this).removeClass("move"); }); Of course, include document ready function. -Jon Thoma

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread Vincent Robert
On May 15, 3:24 pm, "ryan.j" wrote: > as rob said, unless the OP is using the anchor's class itself in > conjunction with some other jquery selector at that point, the OP > would be better off just using :hover. > > jquery is awesome, but using it to do stuff CSS already does better is > conside

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread ryan.j
as rob said, unless the OP is using the anchor's class itself in conjunction with some other jquery selector at that point, the OP would be better off just using :hover. jquery is awesome, but using it to do stuff CSS already does better is considerably less awesome. On May 15, 9:22 am, RobG wr

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread RobG
On May 15, 5:22 pm, Karthikraj wrote: > But CSS :hover will not work in IE6. So better use script Rubbish. The OP wants to use it on an A element, which supports :hover in probably every browser since Navigator and IE 4, if not older. -- Rob

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread Jonathan Vanherpe (T & T NV)
:hover does work in IE6, it's just limited to elements. Jonathan Karthikraj wrote: But CSS :hover will not work in IE6. So better use script On May 15, 9:26 am, RobG wrote: On May 15, 11:35 am, Calvin wrote: Hi, I was able to get this script to work and was wondering if there wa

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread waseem sabjee
$(function() { $("#myid").hover(function() { // when mouse is over element }, function() { // else }); }); On Fri, May 15, 2009 at 9:22 AM, Karthikraj wrote: > > But CSS :hover will not work in IE6. So better use script > > On May 15, 9:26 am, RobG wrote: > > On May 15, 11:35 am, Calvin

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread Karthikraj
But CSS :hover will not work in IE6. So better use script On May 15, 9:26 am, RobG wrote: > On May 15, 11:35 am, Calvin wrote: > > >   Hi, > > >   I was able to get this script to work and was wondering if there was > > a better/proper/more efficient way of writing it. Here is the script: >

[jQuery] Re: A better way of writing this code?

2009-05-14 Thread RobG
On May 15, 11:35 am, Calvin wrote: >   Hi, > >   I was able to get this script to work and was wondering if there was > a better/proper/more efficient way of writing it. Here is the script: > >   $(document).ready(function() { >       $('li.a').hover(function() { >          $(this).addClass('mo

[jQuery] Re: A better way of writing this code?

2009-05-14 Thread Calvin Stephens
Thanks James! On Thu, May 14, 2009 at 6:49 PM, James wrote: > > Slight typo near the end. > > $(document).ready(function() { >     $('li.a').hover( >          function() { $(this).addClass('move'); }, >          function() { $(this).removeClass('move'); } >     ); > )}; > > On May 14, 3:47 pm,

[jQuery] Re: A better way of writing this code?

2009-05-14 Thread James
Slight typo near the end. $(document).ready(function() { $('li.a').hover( function() { $(this).addClass('move'); }, function() { $(this).removeClass('move'); } ); )}; On May 14, 3:47 pm, James wrote: > $(document).ready(function() { >      $('li.a').hover( >      

[jQuery] Re: A better way of writing this code?

2009-05-14 Thread James
$(document).ready(function() { $('li.a').hover( function() { $(this).addClass('move'); }, function() { $(this).removeClass('move'); } )}; )}; On May 14, 3:35 pm, Calvin wrote: >   Hi, > >   I was able to get this script to work and was wondering if there was > a bet

[jQuery] Re: A better way

2008-11-21 Thread Brendan
Very good to know! Now I know what to look for :) On Nov 20, 6:11 pm, Dave Methvin <[EMAIL PROTECTED]> wrote: > > I was looking at the jQuery docs for toggle here > >  http://docs.jquery.com/Events/toggle > > The toggle() without any arguments implements show/hide functionality, > so it's in the

[jQuery] Re: A better way

2008-11-20 Thread Dave Methvin
> I was looking at the jQuery docs for toggle here > http://docs.jquery.com/Events/toggle The toggle() without any arguments implements show/hide functionality, so it's in the Effects section: http://docs.jquery.com/Effects/toggle There are a few other words that overlap like this, such as .l

[jQuery] Re: A better way

2008-11-20 Thread Brendan
That works perfectly! 10+ lines to what could be a one liner. I was looking at the jQuery docs for toggle here http://docs.jquery.com/Events/toggle and it was confusing me... it wasn't clear to me that an empty toggle () would do show/hide. Furthermore, when I tried to add functions into them (

[jQuery] Re: A better way

2008-11-20 Thread Lukas Pitschl | Dressy Vagabonds
Hi, i think this is a short way to do it, altough i haven't tested it myself. $("a.showHide").click(function() { $("#" + $(this).attr('rel')).toggle(); }); It uses the rel attribute of the anchor to find the DIV-Node, and using the toggle method, the div is either hidden or displaye

[jQuery] Re: A better way to animate this list..?

2008-09-23 Thread PaulC
Cheers Guys, a great help!!

[jQuery] Re: A better way to animate this list..?

2008-09-23 Thread ricardobeat
didn't notice that, thanks a lot! - ricardo On Sep 23, 1:00 am, Eric <[EMAIL PROTECTED]> wrote: > You can trim it down a bit by using the index that each() passes to > the callback function: > > $('#jq-secondaryNavigation li').each( function(i) { >      var that = $(this); >     setTimeout(  fun

[jQuery] Re: A better way to animate this list..?

2008-09-22 Thread Eric
You can trim it down a bit by using the index that each() passes to the callback function: $('#jq-secondaryNavigation li').each( function(i) { var that = $(this); setTimeout( function () {that.fadeIn('slow')}, i * 500 ); }); On Sep 22, 11:14 pm, ricardobeat <[EMAIL PROTECTED]> wrote:

[jQuery] Re: A better way to animate this list..?

2008-09-22 Thread ricardobeat
got it! :D $('#jq-secondaryNavigation li').each(function(){ var index = $('#jq-secondaryNavigation li').index(this); setTimeout("$('#jq-secondaryNavigation li:eq("+index +")').fadeOut(300)",index*500); }); 500 is the time between the animations. hope this helps, ricardo On Sep 22, 11:4

[jQuery] Re: A better way to animate this list..?

2008-09-22 Thread ricardobeat
This works, but there must be a better way (without using a global var). fade = function(){ $(this).next().fadeIn(500,fade); }; $('#ul.menu li:first-child').fadeIn(500,fade); On Sep 22, 5:34 pm, PaulC <[EMAIL PROTECTED]> wrote: > I'm new to jQuery so be gentle!! > > I have a menu list, and

[jQuery] Re: A better way to do this?

2008-08-24 Thread MorningZ
".find()" should help $(this).find("ul > li > a").each( )

[jQuery] Re: A better way to do this?

2008-08-24 Thread Dana
Gracias amigo, that did the trick! I knew it was simple ;-) On Aug 24, 4:27 pm, MorningZ <[EMAIL PROTECTED]> wrote: > ".find()" should help > > $(this).find("ul > li > a").each( > > )

[jQuery] Re: A better way to update jQuery & Plug-ins...

2007-09-16 Thread Rick Faircloth
ome way to bring some order to the chaos. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sean Catchpole Sent: Sunday, September 16, 2007 2:00 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: A better way to update jQuery & Plug-ins... Anyone ca

[jQuery] Re: A better way to update jQuery & Plug-ins...

2007-09-16 Thread Sean Catchpole
Anyone can test with the latest version of jquery by grabbing a nightly build. http://code.jquery.com/nightlies/jquery-nightly.js The issue is rather that plugin authors don't have the time to update their plugins right when the new version comes out. I believe there are already some plugins labe