Hover emulating in IE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cezar

    Hover emulating in IE

    Hello.

    How can simple emulating in IE this class ?

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

    Greets,
    Cezar.


  • Brian

    #2
    Re: Hover emulating in IE

    Cezar wrote:
    [color=blue]
    > How can simple emulating in IE this class ?[/color]

    Sorry, I cannot quite grasp what you're asking. Can you try rephrasing
    it in clearer words?
    [color=blue]
    > .example:hover{
    > border: 1px solid #696969;
    > }[/color]

    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)

    Comment

    • Neal

      #3
      Re: Hover emulating in IE

      On Tue, 15 Jun 2004 02:28:43 +0200, Cezar <cezaryk@imail. net.pl> wrote:
      [color=blue]
      > Hello.
      >
      > How can simple emulating in IE this class ?
      >
      > .example:hover{
      > border: 1px solid #696969;
      > }
      >
      > Greets,
      > Cezar.[/color]

      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.

      Comment

      • Jukka K. Korpela

        #4
        Re: Hover emulating in IE

        Neal <neal413@yahoo. com> wrote:
        [color=blue]
        > 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.[/color]

        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.bord erColor = color; }
        </script>
        ....
        <p class="example"
        onmouseover="se tborder(this,'# 696969')"
        onmouseout ="setborder(thi s,'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.bord erColor = 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/

        Comment

        • Cezar

          #5
          Re: Hover emulating in IE

          > Sorry, I cannot quite grasp what you're asking. Can you try rephrasing[color=blue]
          > it in clearer words?
          >[color=green]
          > > .example:hover{
          > > border: 1px solid #696969;
          > > }[/color]
          >
          > 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.[/color]

          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:hove r{
          border: 1px solid #696969;
          }

          Greets,
          Cezar.


          Comment

          • Cezar

            #6
            Re: Hover emulating in IE

            > If I'm right, you want to get :hover to work in IE on elements other than[color=blue]
            > <a>. You'll need to use something like Javascript to do this.[/color]

            Yes, You right. So, I have to ask on javascript group.

            Cezar


            Comment

            • Harlan Messinger

              #7
              Re: Hover emulating in IE

              "Cezar" <cezaryk@imail. net.pl> wrote:
              [color=blue]
              >Hello.
              >
              >How can simple emulating in IE this class ?
              >
              >.example:hover {
              > border: 1px solid #696969;
              >}[/color]



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

              Comment

              • Brian

                #8
                Re: Hover emulating in IE

                Cezar wrote:
                [color=blue]
                > This code not working in IE. That's why I ask for possible solution :-)[/color]

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


                --
                Brian (remove ".invalid" to email me)

                Comment

                • Mark Johnson

                  #9
                  Re: Hover emulating in IE

                  "Cezar" <cezaryk@imail. net.pl> wrote:
                  [color=blue]
                  >Hello.
                  >
                  >How can simple emulating in IE this class ?
                  >
                  >.example:hover {
                  > border: 1px solid #696969;
                  >}[/color]

                  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.


                  Comment

                  • Cezar

                    #10
                    Re: Hover emulating in IE

                    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.rem ovethis@comcast .net> napisal w
                    wiadomosci news:htltc05k1t 6gubih8ph9mk6jb 669bngnhf@4ax.c om...[color=blue]
                    > "Cezar" <cezaryk@imail. net.pl> wrote:
                    >[color=green]
                    > >Hello.
                    > >
                    > >How can simple emulating in IE this class ?
                    > >
                    > >.example:hover {
                    > > border: 1px solid #696969;
                    > >}[/color]
                    >
                    > 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.[/color]


                    Comment

                    • Jan Steffens

                      #11
                      Re: Hover emulating in IE

                      Cezar wrote:[color=blue]
                      > Hello.
                      >
                      > How can simple emulating in IE this class ?
                      >
                      > .example:hover{
                      > border: 1px solid #696969;
                      > }
                      >
                      > Greets,
                      > Cezar.
                      >
                      >[/color]
                      You can use the IE7 IE compatibility patches by Dean Edwards.
                      See http://dean.edwards.name/IE7 for more info.

                      Comment

                      Working...