javascript - 触摸屏的 CSS 下拉菜单。使用 active 作为悬停

标签 javascript android html css drop-down-menu

我想做的是创建一个下拉菜单以在移动网站上使用。由于您无法将鼠标悬停在菜单项上以查看子菜单,因此我需要解决该问题。我研究过这个并试图解决这个问题。很多网站推荐使用 JS 和 onclick 函数。我无法掌握它。谢谢。

这是 HTML。

<html>
<head>
<link rel="stylesheet" href="phone.css">
</head>
<body>
<div class="smenu_div">    
    <ul>
        <li><a href="#">Menu</a>
            <ul>
                <li><a href="index.html">Home</a></li>
                <li><a href="#">Illustrator</a></li>
                <li><a href="#">Web Design</a></li>
        </li>   
            </ul>
    </ul>
</div>
</body></html>

这是 CSS。

/*Small Menu*/
.smenu_div ul
{
    padding:0px;
    margin-top:35px; 
    margin-right:40px;
    font-family:georgia;
    font-size:60px;
    color:#ffffff;
    list-style:none;
    text-indent:15px;
    text-align:center; 
    width:35%;
    float:right;
    overflow:hidden;
}

.smenu_div ul li
{
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    background:#000000;
    line-height:justified;
    border-bottom:1px solid #333;
    margin-top: 10px;
}
.smenu_div li ul:active{ display: block; }

.smenu_div ul li a
{
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    text-decoration:none;
    color:#ffffff;
    display:block;
}
.smenu_div ul li a:hover
{
    color:#000000;
    background:#fdff30;
}
.smenu_div ul li#active
{
    color:#000000;
    background:#fdff30;
}

最佳答案

我几乎听不懂你的问题,但要创建菜单以在带有 html 和 css 的小屏幕网站中使用,请尝试 http://css-tricks.com/convert-menu-to-dropdown/

关于javascript - 触摸屏的 CSS 下拉菜单。使用 active 作为悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24483276/

相关文章:

javascript - 扩展命名空间 JS 导入

android - 微调器未初始化以更正数组

android - java.lang.NoSuchMethodError : com. intellij.ide.plugins.PluginManagerCore.loadDescriptors()[Lcom/intellij/ide/plugins/IdeaPluginDescriptorImpl;

php - 3 列 CSS 中的 Foreach 查询

javascript - 关于禁用按钮的基本 javascript 问题

javascript - 计算 fitBounds() 为给定边界和 map 大小返回的视口(viewport)

javascript - Chrome 扩展显示 "Wants access to this site"

html - & 和 HTML 中的 URL

javascript - StaticInjectorError [HttpClent] : Function/class not supported

android - Android App Bundle 是否会自动从下载的 APK 加载类?