|
Convenient web based access to our favorite web design Usenet groups
|
 |
This is Interesting: Free Magazines for Graphics designers and webmasters
| Author |
| Thread |
 |
|
|
|
|
|
 |
 |
|
|
 |
|
|
 |
 |
Re: Hover emulating in IE |
 |
|
 |
|
|
|
  06-15-04 - 09:15 AM
|
Neal <neal413@yahoo.com> wrote:
> If I'm right, you want to get :hover to work in IE on elements other
> than <a>. You'll need to use something like Javascript to do this.
Yes, manipulating the element's style in Javascript, e.g.
<style type="text/css">
.example { border: solid 1px white; }
</style>
<script type="text/javascript">
function setborder(elem,color) {
elem.style.borderColor = color; }
</script>
...
<p class="example"
onmouseover="setborder(this,'#696969')"
onmouseout ="setborder(this,'white')">
This is an example.</p>
(Naturally you get better advice on Javascript in
news:comp.lang.javascript and its FAQ.)
It would be possible, though hardly wise, to play some ugly tricks to
make e.g. a paragraph's entire text an <a> element (naturally assuming it
does not contain any real <a> elements) and to do your best to make it
_not_ behave as a link except for the purpose of :hover styling. E.g.,
<style type="text/css">
.example a { display: block;
background: white;
color: black;
text-decoration: none;
cursor: default;
border: solid 1px white; }
.example a:hover { border-color: #696969; }
</style>
<script type="text/javascript">
function setborder(elem,color) {
elem.style.borderColor = color; }
</script>
...
<p class="example"><a name="a42" href="#a42" tabindex="0">
This is an example.</a></p>
However it would still behave as a link in many ways, disturbing the
user. You could remove part of the problem by using an onfocus="..." and
onclick="..." attribute that try to prevent the element from getting
focus and to disable any clicking effects, but then you're on your way to
using more Javascript than you need for the relatively simple idea of
simulating :hover with Javascript.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
|
|
 |
 |
Re: Hover emulating in IE |
 |
|
 |
|
|
|
 |
 |
Re: Hover emulating in IE |
 |
|
 |
|
|
|
 |
| All times are GMT. The time now is 03:51 AM. |
 |
|
|
|
|
|  |
|