WordPress.org

Ready to get started?Download WordPress

Forums

Header navigation foldout on click instead of on mouseover (3 posts)

  1. Roy
    Member
    Posted 3 years ago #

    I really dislike these dropdown menus that fold out as soon as the mouse moves over them and now I've got them myself. I use this in my header:

    <div id="navbar">
    <ul id="nav">
    <li><?php wp_list_bookmarks('title_li=&categorize=1') ?></li>
    </ul>
    </div>

    This results in a menu headed by link-categories and on mouseover, the links appear in a dropdown. My stylesheet is this.

    Is there a way to make the dropdown only drop down on mouseclick rather than on mouseover?

  2. David Gard
    Member
    Posted 3 years ago #

    The page is set up to use the :hover method in CSS, meaning that really you'd be looking at some re-coding and using JS to change it to onclick.

    Obviously it's your website and you should make it how you want, but reasons not to do this include -

    • More often than not the top level of a menu will take you to a page, so haveing to click on it to view the menu would either mean that it's a pain to work the site properly, or you lose some good functionality;
    • Search engines don't like searching though JS (and can't search through external JS files), so it's good to avoid large chunks of JS;
    • It'll take ages to do!
  3. Roy
    Member
    Posted 3 years ago #

    Thanks for your reply. I hoped it would be something as simple as onclick. I'm not too good with PHP and CSS, so I'm not going to even try JS :-)
    You have a point at your first dot, but since link categories are (as far as I know) no 'permalinkable addresses', I figured I might get away with that.

    Hm, and here's the part that some browsers don't seem to like:

    #nav li:hover ul {
    	left: auto;
    	display: block;
    	}

    IE6 and for example Opera Mini don't give the dropdown. That's another reason I'd like the menus to be 'clickable'.

    But of course I'm not going to burden myself with a whole lot of coding for that sort of browsers.

Topic Closed

This topic has been closed to new replies.

About this Topic