简体   繁体   English

制作DropDown菜单'DropUp'

[英]Making DropDown menu 'DropUp'

I am trying to implement a drop up menu. 我正在尝试实现一个下拉菜单。 As a starting point I am using an existing drop down menu built using HTML/CSS/jQuery based on CSS trick's Simple jQuery Dropdowns. 作为一个起点,我使用基于CSS技巧的简单jQuery下拉列表使用HTML / CSS / jQuery构建的现有下拉菜单。 (As I couldn't get a pure css one to work on touch devices as they relied on hover states.) (因为我依靠悬停状态,所以我无法获得纯粹的css来触摸设备。)

I have made a little bit of progress fiddling with ul.dropdown ul {top: -100%; } 我用ul.dropdown ul {top: -100%; } ul.dropdown ul {top: -100%; } but this only moves the dropdown up one 'row', I am not convinced that's semantic css. ul.dropdown ul {top: -100%; }但这只是移动下拉了一个“行”,我不相信这是语义的CSS。

Any ideas how I could achieve this ? 有什么想法我能做到这一点吗?

I have made a jsfiddle of the problem here - http://jsfiddle.net/TTTb6/ 我在这里提出了一个问题的方法 - http://jsfiddle.net/TTTb6/

Try changing this: 尝试改变这个:

ul.dropdown ul {
    bottom: 100%;
}

Updted jsfiddle 更新的jsfiddle

Instead of top , use bottom: 100%; 而不是top ,使用bottom: 100%; :

ul.dropdown ul {
    position: absolute;
    bottom: 100%;
}

For touch devices you need to write code in click event. 对于触摸设备,您需要在点击事件中编写代码。 please check this one here you will get your answer... 请在这里查看这个,你会得到你的答案......

Click to close jQuery dropdown menu on mobile devices while retaining other behavior 单击以关闭移动设备上的jQuery下拉菜单,同时保留其他行为

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM