子菜单在悬停时消失

时间:2013-05-07 18:32:28

标签: html css menu hover submenu

我的网站的子菜单在悬停时消失。我很确定它在header.php中。这是我认为与此相关的代码的代码(参见:):

<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" <?php language_attributes();?>> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" <?php language_attributes();?>> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" <?php language_attributes();?>> <![endif]-->
<!--[if IE 9 ]><html class="ie ie9" <?php language_attributes();?>> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html <?php language_attributes();?>> <!--<![endif]-->
<head>
    <title><?php if ( is_category() ) {
        echo __('Category Archive for &quot;', 'theme1773'); single_cat_title(); echo __('&quot; | ', 'theme1773'); bloginfo( 'name' );
    } elseif ( is_tag() ) {
        echo __('Tag Archive for &quot;', 'theme1773'); single_tag_title(); echo __('&quot; | ', 'theme1773'); bloginfo( 'name' );
    } elseif ( is_archive() ) {
        wp_title(''); echo __(' Archive | ', 'theme1773'); bloginfo( 'name' );
    } elseif ( is_search() ) {
        echo __('Search for &quot;', 'theme1773').wp_specialchars($s).__('&quot; | ', 'theme1773'); bloginfo( 'name' );
    } elseif ( is_home() || is_front_page()) {
        bloginfo( 'name' ); echo ' | '; bloginfo( 'description' );
    }  elseif ( is_404() ) {
        echo __('Error 404 Not Found | ', 'theme1773'); bloginfo( 'name' );
    } elseif ( is_single() ) {
        wp_title('');
    } else {
        echo wp_title( ' | ', false, right ); bloginfo( 'name' );
    } ?></title>
    <meta name="description" content="<?php wp_title(); echo ' | '; bloginfo( 'description' ); ?>" />
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="icon" href="<?php bloginfo( 'template_url' ); ?>/favicon.ico" type="image/x-icon" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'rss2_url' ); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'atom_url' ); ?>" />
    <?php /* The HTML5 Shim is required for older browsers, mainly older versions IE */ ?>
  <!--[if lt IE 8]>
    <div style=' clear: both; text-align:center; position: relative;'>
        <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" alt="" /></a>
    </div>
  <![endif]-->
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/normalize.css" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/prettyPhoto.css" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/grid.css" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/jquery-ui.css" />
    <?php
        /* We add some JavaScript to pages with the comment form
         * to support sites with threaded comments (when in use).
         */
        if ( is_singular() && get_option( 'thread_comments' ) )
            wp_enqueue_script( 'comment-reply' );

        /* Always have wp_head() just before the closing </head>
         * tag of your theme, or you will break many plugins, which
         * generally use this hook to add elements to <head> such
         * as styles, scripts, and meta tags.
         */
        wp_head();
    ?>
  <!--[if lt IE 9]>
  <style type="text/css">
    .blue,
    .black,
    .white,
    .button,
    .white h1, .white h3, .black h1, .black h3, .blue h3, .blue .title, #booking-form h2 {
      behavior:url(<?php bloginfo('stylesheet_directory'); ?>/PIE.php)
      }
  </style>
  <![endif]-->

  <script type="text/javascript">
    // initialise plugins
        jQuery(function(){
            // main navigation init
            jQuery('ul.sf-menu').superfish({
                delay:       <?php echo of_get_option('sf_delay'); ?>,      // one second delay on mouseout 
                animation:   {opacity:'<?php echo of_get_option('sf_f_animation'); ?>'<?php if (of_get_option('sf_sl_animation')=='show') { ?>,height:'<?php echo of_get_option('sf_sl_animation'); ?>'<?php } ?>}, // fade-in and slide-down animation
                speed:       '<?php echo of_get_option('sf_speed'); ?>',  // faster animation speed 
                autoArrows:  <?php echo of_get_option('sf_arrows'); ?>,   // generation of arrow mark-up (for submenu) 
                dropShadows: <?php echo of_get_option('sf_shadows'); ?>   // drop shadows (for submenu)
            });

        });

        // Init for audiojs
        audiojs.events.ready(function() {
            var as = audiojs.createAll();
        });

        // Init for si.files
        SI.Files.stylizeAll();
  </script>

  <script type="text/javascript">
        jQuery(window).load(function() {
            // nivoslider init
            jQuery('#slider').nivoSlider({
                effect: '<?php echo of_get_option('sl_effect'); ?>',
                slices:<?php echo of_get_option('sl_slices'); ?>,
                boxCols:<?php echo of_get_option('sl_box_columns'); ?>,
                boxRows:<?php echo of_get_option('sl_box_rows'); ?>,
                animSpeed:<?php echo of_get_option('sl_animation_speed'); ?>,
                pauseTime:<?php echo of_get_option('sl_pausetime'); ?>,
                directionNav:<?php echo of_get_option('sl_dir_nav'); ?>,
                directionNavHide:<?php echo of_get_option('sl_dir_nav_hide'); ?>,
                controlNav:<?php echo of_get_option('sl_control_nav'); ?>
            });
        });
    </script>


  <style type="text/css">

        <?php $background = of_get_option('body_background');
            if ($background != '') {
                if ($background['image'] != '') {
                    echo 'body { background-image:url('.$background['image']. '); background-repeat:'.$background['repeat'].'; background-position:'.$background['position'].';  background-attachment:'.$background['attachment'].'; }';
                }
                if($background['color'] != '') {
                    echo 'body { background-color:'.$background['color']. '}';
                }
            };
        ?>

        <?php $header_styling = of_get_option('header_color'); 
            if($header_styling != '') {
                echo '#header {background-color:'.$header_styling.'}';
            }
        ?>

        <?php $links_styling = of_get_option('links_color'); 
            if($links_styling) {
                echo 'a{color:'.$links_styling.'}';
                echo '.button {background:'.$links_styling.'}';
            }
        ?>

  </style>
</head>

<body <?php body_class(); ?>>

<div id="main"><!-- this encompasses the entire Web site -->
    <header id="header">
        <div class="container_12 clearfix">
            <div class="grid_12">
                <div id="widget-header">
                    <?php if ( ! dynamic_sidebar( 'Header' ) ) : ?><!-- Wigitized Header --><?php endif ?>
                </div><!--#widget-header-->
                <div class="clear"></div>
                <div class="row-top clearfix">
                    <div class="logo">
                        <a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                    </div>


 **<nav class="primary">
                      <?php wp_nav_menu( array(
                        'container'       => 'ul', 
                        'menu_class'      => 'sf-menu', 
                        'menu_id'         => 'topnav',
                        'depth'           => 0,
                        'theme_location' => 'header_menu' 
                        )); 
                      ?>
                    </nav><!--.primary-->**

                </div>
                <?php if ( of_get_option('g_search_box_id') == 'yes') { ?>  
                  <div id="top-search">
                    <form method="get" action="<?php echo get_option('home'); ?>/">
                      <input type="text" name="s"  class="input-search"/><input type="submit" value="<?php _e('GO', 'theme1773'); ?>" id="submit">
                    </form>
                  </div>  
                <?php } ?>
              </div>
        </div><!--.container_12-->
    </header>
    <?php if( is_front_page() ) { ?>
    <section id="slider-wrapper">
        <div class="container_12 clearfix">
            <div class="grid_12">
                <?php include_once(TEMPLATEPATH . '/slider.php'); ?>
            </div>
        </div>
    </section><!--#slider-->
    <?php } ?>
    <div class="container_12 primary_content_wrap clearfix">

以下是链接:http://bestinfinity.com/WordPress/

如果有人可以帮助我,我一定很感激。

谢谢!

2 个答案:

答案 0 :(得分:2)

更改top:27px; style.css - &gt;第527行

 .sf-menu li:hover ul, .sf-menu li.sfHover ul {
    left: 0;
    top: 27px;
    z-index: 99;
    }

答案 1 :(得分:1)

另一种方式就是这样 -

.sf-menu > li > a {
    font-family: 'Open Sans',sans-serif;
    font-size: 15px;
    line-height: 1.2;
    padding: 4px 9px 5px;
    margin: 0px 1px 29px 0px; /********* Important Bit ***********/
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    color: rgb(255, 255, 255);
    background: url("images/menu-hover-tail.gif") no-repeat scroll 0px -999em transparent;
    letter-spacing: -1px;
    border-radius: 5px 5px 5px 5px;
    position: relative;
}

.sf-menu li:hover ul, .sf-menu li.sfHover ul {
    left: 0px;
    top: 55px;   /*** Important Bit ***/
    z-index: 99;
}

通过这些更改,子菜单将与导航栏的底部对齐,以获得更清晰的外观。