Previous Message
Next Message

whatever:hover fast and easy via Dynamic Properties

Sent by Klaus Hartl on 11 July 2005 07:07


>>IE/Win:
>>.whatever {
>>     background-color: expression(this.runtimeStyle.backgroundColor,
>>this.onmouseover = function() { this.className += ' whateverhover'; },
>>this.onmouseout = function() { this.className =
>>this.className.replace('whateverhover', ''); });
>>}
> 
> 
> Very nice! You can take this part out of the expression and it will 
> still work: --this.runtimeStyle.backgroundColor,--
> 
> Did you leave that part in by accident or was there a purpose?

Hi Brett,

thanks for the tip! I did not leave that part in by accident - I just 
thought, if I leave out defining the background color somehow, I would 
overwrite the background from .whatever in the basic style sheet.

One can also use a totally unused property to assign the events, like:
..whatever {
     zoom: expression(
         this.onmouseover = function() { this.className += ' 
whateverhover'; },
         this.onmouseout = function() { this.className = 
this.className.replace('whateverhover', ''); });
}

But this may have side effects in some cases. "zoom" for example 
triggers "layout", which can have some effect on the rendering...


Regards, Klaus


______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: