简体   繁体   English

语义UI下拉列表未显示下拉列表,但其他所有内容均正常运行

[英]Semantic UI Dropdown is not showing the drop down but everything else is working

I am using Semantic UI Dropdown in my ASP.NET Web Forms application. 我在ASP.NET Web窗体应用程序中使用语义UI下拉列表 Its working fine in this fiddle . 它在这个小提琴中工作正常。 But in my application it is not showing the drop down when clicked on the selector div. 但是在我的应用程序中,单击选择器div时没有显示下拉列表。 Also, I can select the elements by searching but in that case too the drop down is not showing. 另外,我可以通过搜索选择元素,但在这种情况下,也不会显示下拉列表。 When I inspected using Firefox, I found that display: none property is not changing for .menu class. 当我使用Firefox检查时,发现display: none .menu类的属性未更改。 When I researched on SO, I found these related questions: Semantic-ui dropdown is not working and semantic UI dropdown not working . 在研究SO时,我发现了以下相关问题: Semantic-ui下拉列表不起作用语义UI下拉列表不起作用 I tried the solutions but none of them seem to work. 我尝试了解决方案,但似乎都不起作用。 I checked other css in my project none of them shows any conflict. 我检查了项目中的其他CSS,它们都没有显示任何冲突。 Then, what is wrong with it? 那么,这有什么问题呢? You can find my dropdown code in the fiddle. 您可以在小提琴中找到我的下拉代码。

Sometimes you'll have to initialize the JS part of semantic. 有时,您必须初始化语义的JS部分。 Try calling the .dropdown() function in the .onLoad() of the window. 尝试在窗口的.onLoad()中调用.dropdown()函数。

window.onload = function(){
    $('.ui.dropdown').dropdown();
};

You cant use multiple menu classes !! 您不能使用多个菜单类! . Just read the doc : http://semantic-ui.com/modules/dropdown.html . 只需阅读文档: http : //semantic-ui.com/modules/dropdown.html I edit your fiddle, and it works now: 我编辑您的小提琴,现在可以使用:

<div id="itdd" class="ui dropdown search button" style="background:maroon; color:white">
<span class="text">Click to select</span>
<div class="menu">
    <div class="item" data-value="1"><i class="fa fa-rupee"></i>&nbsp;&nbsp;Currency</div>
    <div class="item" data-value="2"><i class="fa fa-rupee"></i>&nbsp;&nbsp;Currency</div>
    <div class="item" data-value="3"><i class="fa fa-rupee"></i>&nbsp;&nbsp;Currency</div>
    <div class="item" data-value="1"><i class="fa fa-rupee"></i>&nbsp;&nbsp;Currency</div>
    <div class="item" data-value="1"><i class="fa fa-rupee"></i>&nbsp;&nbsp;Currency</div>
    <div class="item" data-value="1"><i class="fa fa-rupee"></i>&nbsp;&nbsp;Currency</div>
</div>

Here: http://jsfiddle.net/ow2by6av/7/ 此处: http//jsfiddle.net/ow2by6av/7/

就我而言,我将minchars设置为大于1。在这种情况下,单击下拉列表不会呈现菜单。

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

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