Results 1 to 2 of 2

Thread: Make unordered list bullet appear on hover

  1. #1
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Make unordered list bullet appear on hover

    Hello CSS gurus,

    I want to make an unordered list without any bullets for a menu.

    I want a custom bullet (eg: double chevron) to appear when the mouse hovers over the link.

    I am stuck.

    Any tips/tricks/pouinters would be most welcome.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Well, this is easy to do for everything else, but not so for IE. IE doesn't support :hover for non-<a> elements, and it doesn't support most of the selectors that would allow us to work around this. Therefore, the only way to do it is to simulate it with Javascript.
    Code:
    <style type="text/css">
    ul {
      list-style-type: none;
    }
    
    li:hover, li.hovered {
      list-style-image = url(path/to/image.jpg);
    }
    </style>
    <script type="text/javascript">
    if(document.all) window.onload = function() {
      var c = document.getElementsByTagName("li");
      for(var i=0;i<c.length;i++) {
        c[i].onmouseover = function() {
          this.className = "hovered";
        };
        c[i].onmouseout = function() {
          this.className = "";
        };
      };
    };
    </script>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •