[jQuery] Re: help to simplify code

2009-09-21 Thread benoit v.
Just read that topic. Very nice effect, and nice && helpful code improvements! You guys are great. On Sep 21, 2:18 am, Karl Swedberg wrote: > Sure. > > // find all "a" elements within $navigation (which is a variable for $ > ('#navigation') > $navigation.find('a') > // bind two events to those l

[jQuery] Re: help to simplify code

2009-09-20 Thread Karl Swedberg
Sure. // find all "a" elements within $navigation (which is a variable for $ ('#navigation') $navigation.find('a') // bind two events to those links: mouseenter and mouseleave. pass the event object as an argument to the anonymous function .bind('mouseenter mouseleave', function(event) {

[jQuery] Re: help to simplify code

2009-09-20 Thread alienfactory
Thanks Karl That was more then i expected. However the $navigation.find('a') section is a little over my head could add a few comments to that one to help me understand it Terry On Sep 20, 8:49 am, Karl Swedberg wrote: > Here is another way you could do it: > > var bgColors = { >    servi

[jQuery] Re: help to simplify code

2009-09-20 Thread Karl Swedberg
Here is another way you could do it: var bgColors = { services: '#8ac2b7', vision: '#9e97ca', approach: '#e5b120', team: '#cf1858' }; var $navigation = $('#navigation'); $('#bodycopy').children() .bind('mouseenter', function() { $(this).siblings().stop().fadeTo('slow', .2); $n

[jQuery] Re: help to simplify code

2009-09-20 Thread ryan.j
http://docs.jquery.com/Traversing/siblings On Sep 20, 3:51 pm, alienfactory wrote: > i was asking about javascript/jquery not html 101 but that is cool > though and yes that was snarky. LOL > > No worries at least you are trying to help thanks > > I dont see where you are fading the addtional di

[jQuery] Re: help to simplify code

2009-09-20 Thread alienfactory
i was asking about javascript/jquery not html 101 but that is cool though and yes that was snarky. LOL No worries at least you are trying to help thanks I dont see where you are fading the addtional div see link above for sample you focused on the navigavtion but i have 4 divs when mousing over

[jQuery] Re: help to simplify code

2009-09-20 Thread ryan.j
for fear of offending you further, i apologise in advance for posting code. personally i'd be tempted to call 'test1(this)' on the mouseover and mouseout events and have it do something like... function test1(t) { var c = $(t).css('background-color') var o = '1'

[jQuery] Re: help to simplify code

2009-09-20 Thread ryan.j
i wasn't being snarky mate, just that you phrased your question like a homework assignment! besides, i thought i /was/ answering your question tbh :S On Sep 20, 3:14 am, alienfactory wrote: > wow really! not sure what to say about that. > > Here is a development link to the actual > projecthtt

[jQuery] Re: help to simplify code

2009-09-19 Thread alienfactory
wow really! not sure what to say about that. Here is a development link to the actual project http://alienfactory.com/vision1/ if any one would like to help out on the javascript jquery question above Thanks in advance for any help

[jQuery] Re: help to simplify code

2009-09-19 Thread ryan.j
by the way, does that code work? On Sep 19, 10:57 pm, "ryan.j" wrote: > this looks a bit like a homework assignment to be honest  ;) > > for ease of maintenance and to avoid repeating code i'd stick the two > anonymous functions into a single own 'proper' function and pass the > variables to it.

[jQuery] Re: help to simplify code

2009-09-19 Thread ryan.j
this looks a bit like a homework assignment to be honest ;) for ease of maintenance and to avoid repeating code i'd stick the two anonymous functions into a single own 'proper' function and pass the variables to it. you're also getting the target elements on every single mouseover and mouseout