Problem with freezing with unrelated elements in IE

Is there a way to use the "hover" attribute for all html elements, and not just "" in IE?

for example, "li: hover". it does not work in IE6. (I do not know about other versions of IE).

Edited: I just want to do this with CSS without javascript. This is a simple menu.

+3
source share
4 answers

I do not think that in any case you can do this without javascript in IE 6.

If this is a single-level menu, you can customize the style to render links as a display: lock inside li so that you can freeze on them, and if necessary add spaces inside links for additional styling flexibility, but personally there has never been much luck. trying to extend this to multi-level menus.

An elegant degradation strategy may be the best choice there.

+3
source

No, IE6 incorrectly implemented the: hover pseudo-class for all elements. He supports it only for anchors.

+4
source

onmouseover/onmouseout javascript.

div .

, div, .

JQuery , .

<span id="hoverSpan" class="hoverelement" hoverdata="this is my hoverdata">HoverSpan</span>
<a href="#" id="hoverAnchor class="hoverelement" hoverdata="this is my hover data">HoverAnchor</a>
<div id="hoverdiv" style="display:none"></div>

<script language="javascript">
  $(document).ready(function () {
     $(".hoverelement").each( function () {
       var myelement = $(this);
       myelement.mouseover( function (e) {
         var myhovertext = myelement.attr("hoverdata");
         $("#hoverdiv").html(myhovertext).show();
       });
       myelement.mouseout( function (e) {
         $("#hoverdiv").html(myhovertext).hide();
       });
     });
  });
</script>

, , . , "hoverelement"

+2
source

try jquery ... I don’t know for sure, but it can work in IE6 ....

0
source

Source: https://habr.com/ru/post/1743916/


All Articles