[jQuery] Re: Can jQuery get attributes of the actual style sheet?

2007-08-05 Thread Nazgulled

I also would like to know how to do this if it's even possible!

I have this on my CSS file:
div#cpblock-links a:link,
div#cpblock-links a:visited,
div#cpblock-links a:active {
color: #ff;
text-decoration: none;
}

div#cpblock-links a:hover {
color: #535f68;
text-decoration: none;
}

And I need to get both that colors so I can use the colorGradient
plugin. I didn't want to define the colors anywhere else (and twice)
than the style sheet.

On Jul 23, 10:28 pm, Matt Penner [EMAIL PROTECTED] wrote:
 IE does not support the CSS class :active but FireFox does.  I use this to
 change the background color on a div to give feedback similar to a button
 click.

 For IE users I attach the mousedown and mouseup events to a function that
 simply does the same thing.  However, if I ever change the color in my CSS
 class I have to remember to change the jQuery function to match.

 Can I have jQuery find this background color attribute in the css class in
 the style sheet?  If so, I could just change it once in the CSS style sheet
 and jQuery would use the latest value.

 I haven't seen any examples on obtaining values from a style sheet so I
 thought I'd ask if it was even possible.

 Thanks,
 Matt Penner



[jQuery] Re: Can jQuery get attributes of the actual style sheet?

2007-08-05 Thread Giuliano Marcangelo
Nazgulled,

one ideadon't know how practical it would bebut you could enter a
new declaration in your stylesheet,

div#cpblock-links a:hover, div#cpblock-links a.hover {
   color: #535f68;
   text-decoration: none;
}


Then just before you run your routine, clone the div#cpblock-links
a:link..add a class of hoverand retrieve the css color of
the cloned element...to use in colorGradient plug in..

as I say, do not know how practical this would be

:-)

On 05/08/07, Nazgulled [EMAIL PROTECTED] wrote:


 I also would like to know how to do this if it's even possible!

 I have this on my CSS file:
 div#cpblock-links a:link,
 div#cpblock-links a:visited,
 div#cpblock-links a:active {
 color: #ff;
 text-decoration: none;
 }

 div#cpblock-links a:hover {
 color: #535f68;
 text-decoration: none;
 }

 And I need to get both that colors so I can use the colorGradient
 plugin. I didn't want to define the colors anywhere else (and twice)
 than the style sheet.

 On Jul 23, 10:28 pm, Matt Penner [EMAIL PROTECTED] wrote:
  IE does not support the CSS class :active but FireFox does.  I use this
 to
  change the background color on a div to give feedback similar to a
 button
  click.
 
  For IE users I attach the mousedown and mouseup events to a function
 that
  simply does the same thing.  However, if I ever change the color in my
 CSS
  class I have to remember to change the jQuery function to match.
 
  Can I have jQuery find this background color attribute in the css class
 in
  the style sheet?  If so, I could just change it once in the CSS style
 sheet
  and jQuery would use the latest value.
 
  I haven't seen any examples on obtaining values from a style sheet so I
  thought I'd ask if it was even possible.
 
  Thanks,
  Matt Penner




[jQuery] Re: Can jQuery get attributes of the actual style sheet?

2007-08-05 Thread Nazgulled

I didn't understand a bit in what you just said :/
Could you provide an example?

On Aug 5, 9:17 pm, Giuliano Marcangelo
[EMAIL PROTECTED] wrote:
 Nazgulled,

 one ideadon't know how practical it would bebut you could enter a
 new declaration in your stylesheet,

 div#cpblock-links a:hover, div#cpblock-links a.hover {
color: #535f68;
text-decoration: none;

 }

 Then just before you run your routine, clone the div#cpblock-links
 a:link..add a class of hoverand retrieve the css color of
 the cloned element...to use in colorGradient plug in..

 as I say, do not know how practical this would be

 :-)

 On 05/08/07, Nazgulled [EMAIL PROTECTED] wrote:



  I also would like to know how to do this if it's even possible!

  I have this on my CSS file:
  div#cpblock-links a:link,
  div#cpblock-links a:visited,
  div#cpblock-links a:active {
  color: #ff;
  text-decoration: none;
  }

  div#cpblock-links a:hover {
  color: #535f68;
  text-decoration: none;
  }

  And I need to get both that colors so I can use the colorGradient
  plugin. I didn't want to define the colors anywhere else (and twice)
  than the style sheet.

  On Jul 23, 10:28 pm, Matt Penner [EMAIL PROTECTED] wrote:
   IE does not support the CSS class :active but FireFox does.  I use this
  to
   change the background color on a div to give feedback similar to a
  button
   click.

   For IE users I attach the mousedown and mouseup events to a function
  that
   simply does the same thing.  However, if I ever change the color in my
  CSS
   class I have to remember to change the jQuery function to match.

   Can I have jQuery find this background color attribute in the css class
  in
   the style sheet?  If so, I could just change it once in the CSS style
  sheet
   and jQuery would use the latest value.

   I haven't seen any examples on obtaining values from a style sheet so I
   thought I'd ask if it was even possible.

   Thanks,
   Matt Penner



[jQuery] Re: Can jQuery get attributes of the actual style sheet?

2007-08-05 Thread Nazgulled

Well, after a while and after talking to some people, I managed to
make it work. Let's hope this message gets posted before someone sees
my previous and wastes time providing me some example that I no longer
require (thank you though, just in case)...

CSS:
div#cpblock-links a:link,
div#cpblock-links a:visited,
div#cpblock-links a:active {
color: #ff;
text-decoration: none;
}

a.cpblock-link,
div#cpblock-links a:hover {
color: #535f68;
text-decoration: none;
}

JS:
$('div#cpblock-links a').each(function(elem) {
//
if(elem == 0) {
startColor = $(this).css('color');
endColor = $(this).clone(false).addClass('cpblock-
link').css('color');
}

$(this).mouseover(function() {
$(this).css({ color: startColor }); // Little bug fix on first
mouseover
$(this).animate({ color: endColor }, 250);
});

$(this).mouseout(function() {
$(this).animate({ color: startColor }, 250);
});
});

Was something like this that you had in mind Giuliano Marcangelo?
Anyway, one thing I didn't really understood was what you meant by
how practical would this be. What did you mean by that?

Anyway, if anyone has a better solution, more elegant I mean, without
the need to clone or create elements that are not really used besides
for this workaround. I would be glad to hear it out.

Thanks Giuliano Marcangelo.



[jQuery] Re: Can jQuery get attributes of the actual style sheet?

2007-07-23 Thread Andy Matthews
Actually IE does support that class, but only on A tags.
 
Just to be fair.

  _  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Penner
Sent: Monday, July 23, 2007 4:28 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Can jQuery get attributes of the actual style sheet?


IE does not support the CSS class :active but FireFox does.  I use this to
change the background color on a div to give feedback similar to a button
click.

For IE users I attach the mousedown and mouseup events to a function that
simply does the same thing.  However, if I ever change the color in my CSS
class I have to remember to change the jQuery function to match. 

Can I have jQuery find this background color attribute in the css class in
the style sheet?  If so, I could just change it once in the CSS style sheet
and jQuery would use the latest value.

I haven't seen any examples on obtaining values from a style sheet so I
thought I'd ask if it was even possible. 

Thanks,
Matt Penner



[jQuery] Re: Can jQuery get attributes of the actual style sheet?

2007-07-23 Thread Glen Lipka

What happens when you put alert($(a:active).css(background-color))  ?

Glen

On 7/23/07, Andy Matthews [EMAIL PROTECTED] wrote:


 Actually IE does support that class, but only on A tags.

Just to be fair.

 --
*From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Matt Penner
*Sent:* Monday, July 23, 2007 4:28 PM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Can jQuery get attributes of the actual style sheet?

IE does not support the CSS class :active but FireFox does.  I use this to
change the background color on a div to give feedback similar to a button
click.

For IE users I attach the mousedown and mouseup events to a function that
simply does the same thing.  However, if I ever change the color in my CSS
class I have to remember to change the jQuery function to match.

Can I have jQuery find this background color attribute in the css class in
the style sheet?  If so, I could just change it once in the CSS style sheet
and jQuery would use the latest value.

I haven't seen any examples on obtaining values from a style sheet so I
thought I'd ask if it was even possible.

Thanks,
Matt Penner