[jQuery] Re: Is it possible to alter internal CSS properties?

2007-11-01 Thread James Dempster

You could use LiveQuery, or I've not checked if this is the right way
of doing it or even if it will work but I guess you could do.

$('style type=text/css.someClass { background-color:yellow }/
style').appendTo('head');

/James

On Nov 1, 9:24 am, Jesse Klaasse [EMAIL PROTECTED] wrote:
 As we all know, we can do the following using jQuery:

 $('.someClass').css(background-color: yellow);

 This first matches all elements which have the class someClass, and then
 alters the css of the matched elements.
 This won't work when the class is dynamically added somewhere in the
 page, for example on a mouseover.

 Is it somehow possible to really alter the internal style sheet
 definition, in order to reflect the wanted changes when a class is
 dynamically added?

 My guess is that this is not possible at all, but I'm not sure.. Any
 ideas? Thanks!



[jQuery] Re: Is it possible to alter internal CSS properties?

2007-11-01 Thread Danny

You can manipulate stylesheets, though it's not pretty (or built-in to
jQuery; you could write plugins to do it).
See http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript

On Nov 1, 4:24 am, Jesse Klaasse [EMAIL PROTECTED] wrote:
 As we all know, we can do the following using jQuery:

 $('.someClass').css(background-color: yellow);

 This first matches all elements which have the class someClass, and then
 alters the css of the matched elements.
 This won't work when the class is dynamically added somewhere in the
 page, for example on a mouseover.

 Is it somehow possible to really alter the internal style sheet
 definition, in order to reflect the wanted changes when a class is
 dynamically added?

 My guess is that this is not possible at all, but I'm not sure.. Any
 ideas? Thanks!



[jQuery] Re: Is it possible to alter internal CSS properties?

2007-11-01 Thread Danny

I actually wrote a plugin that may be helpful (worked with jQuery 1.1,
Firefox and Internet Explorer. I haven't updated it since)
See http://www.nabble.com/Creating-stylesheets-in-jQuery-tf3298905.html#a9176651
Lets you write $.style('.someClass').css('background-color',
'yellow');

On Nov 1, 5:17 pm, Danny [EMAIL PROTECTED] wrote:
 You can manipulate stylesheets, though it's not pretty (or built-in to
 jQuery; you could write plugins to do it).
 Seehttp://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript

 On Nov 1, 4:24 am, Jesse Klaasse [EMAIL PROTECTED] wrote:



  As we all know, we can do the following using jQuery:

  $('.someClass').css(background-color: yellow);

  This first matches all elements which have the class someClass, and then
  alters the css of the matched elements.
  This won't work when the class is dynamically added somewhere in the
  page, for example on a mouseover.

  Is it somehow possible to really alter the internal style sheet
  definition, in order to reflect the wanted changes when a class is
  dynamically added?

  My guess is that this is not possible at all, but I'm not sure.. Any
  ideas? Thanks!- Hide quoted text -

 - Show quoted text -