This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > June 2004 > Hover emulating in IE





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Hover emulating in IE
Cezar

2004-06-14, 11:15 pm

Hello.

How can simple emulating in IE this class ?

..example:hover{
border: 1px solid #696969;
}

Greets,
Cezar.


Brian

2004-06-14, 11:15 pm

Cezar wrote:

> How can simple emulating in IE this class ?


Sorry, I cannot quite grasp what you're asking. Can you try rephrasing
it in clearer words?

> .example:hover{
> border: 1px solid #696969;
> }


This looks correct; what is the problem you are having? Are you trying
to create hover styles on something other than an <a> element?

By the way, it's best not to *add* a border on :hover. Consider
changing only the border color on :hover.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Neal

2004-06-14, 11:15 pm

On Tue, 15 Jun 2004 02:28:43 +0200, Cezar <cezaryk@imail.net.pl> wrote:

> Hello.
>
> How can simple emulating in IE this class ?
>
> .example:hover{
> border: 1px solid #696969;
> }
>
> Greets,
> Cezar.


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.
Jukka K. Korpela

2004-06-15, 4: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/
Cezar

2004-06-15, 7:14 am

> Sorry, I cannot quite grasp what you're asking. Can you try rephrasing
> it in clearer words?
>
>
> This looks correct; what is the problem you are having? Are you trying
> to create hover styles on something other than an <a> element?
>
> By the way, it's best not to *add* a border on :hover. Consider
> changing only the border color on :hover.


This code not working in IE. That's why I ask for possible solution :-)

..buttons2{
background: #fafafa url(../pic/inputbg2.gif);
padding:0;
margin:0 0 0 6px;
cursor:pointer;
height:25px;
border: 1px solid #a9a9a9;
}
..buttons2:hover{
border: 1px solid #696969;
}

Greets,
Cezar.


Cezar

2004-06-15, 7:14 am

> 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, You right. So, I have to ask on javascript group.

Cezar


Harlan Messinger

2004-06-15, 12:15 pm

"Cezar" <cezaryk@imail.net.pl> wrote:

>Hello.
>
>How can simple emulating in IE this class ?
>
>.example:hover{
> border: 1px solid #696969;
>}


http://www.vladdy.net/demos/iepseudoclassesfix.html

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.
Brian

2004-06-15, 12:15 pm

Cezar wrote:

> This code not working in IE. That's why I ask for possible solution :-)


I cannot help you without a url. The code snippets you wrote do not
provide the necessary information.


--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Mark Johnson

2004-06-15, 7:16 pm

"Cezar" <cezaryk@imail.net.pl> wrote:

>Hello.
>
>How can simple emulating in IE this class ?
>
>.example:hover{
> border: 1px solid #696969;
>}


People have suggested javascript, and Messinger suggested the
'behaviors' one can use with IE.

If you also need a visited state, however, and I don't know if you do,
then you'd have to stick with an anchor, and essentially use styles to
expand an anchor over the area that you wish to behave as an anchor.
If that's not what you need to do, then jscript or behaviors would
seem the thing.


Cezar

2004-06-16, 7:14 am

Thanks for any advices.

I used script from this example
http://www.xs4all.nl/~peterned/examples/cssmenu.html.
Working good.

Regards,
Cezar.

Uzytkownik "Harlan Messinger" <hmessinger.removethis@comcast.net> napisal w
wiadomosci news:htltc05k1t6gubih8ph9mk6jb669bngnhf@4ax.com...
> "Cezar" <cezaryk@imail.net.pl> wrote:
>
>
> http://www.vladdy.net/demos/iepseudoclassesfix.html
>
> --
> Harlan Messinger
> Remove the first dot from my e-mail address.
> Veuillez ๔ter le premier point de mon adresse de courriel.



Jan Steffens

2004-06-20, 7:15 pm

Cezar wrote:
> Hello.
>
> How can simple emulating in IE this class ?
>
> .example:hover{
> border: 1px solid #696969;
> }
>
> Greets,
> Cezar.
>
>

You can use the IE7 IE compatibility patches by Dean Edwards.
See http://dean.edwards.name/IE7 for more info.
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews