jQuery Mobile显示隐藏的选择元素 [英] jQuery Mobile displays hidden select element

查看:73
本文介绍了jQuery Mobile显示隐藏的选择元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参见此select元素和display:none.在jQuery Mobile中,尽管有此显示,但仍然显示:

See this select element with display:none. In jQuery Mobile it is displayed despite this:

<select id="dddd" name="dddd"
        data-mini="true" data-native-menu="false" data-theme="c"
        onChange=""
        style="display:none">     
  <option value="1">An optinos</option>
</select>

我试图显示/隐藏依赖于其他用户动作的jQuery Mobile select元素,因此为什么要执行上述操作.

I'm trying to show/hide jQuery Mobile select elements dependent on other user actions hence why I'm doing the above.

有什么想法吗?

推荐答案

页面加载时,jQuery Mobile增强了页面的外观和感觉.不幸的是,jQuery mobile当前存在一个问题,即它无法将自定义类(甚至通过style属性附加自定义样式)附加到增强元素上.请检查 https://github.com/jquery/jquery-mobile/issues/3577 以查找问题.作为一种解决方法,尽管此问题仍未解决,您实际上可以将其包装在div元素中,然后控制div包装器的显示.

When your page loads, jQuery Mobile enhances your page to have it the mobile look-and-feel. Unfortunately, there is currently an issue with jQuery mobile that it cannot attach custom classes (and even custom styles, by the style attribute) to enhanced elements. Please check https://github.com/jquery/jquery-mobile/issues/3577 for the issue. As a workaround while this issue is still not resolved, you may actually wrap it inside a div element and control the display of the div wrapper instead.

<div id="dddd-wrapper" class="ui-screen-hidden">
  <select data-mini="true" data-native-menu="false" id="dddd" name="dddd" data-theme="c"     onChange="" style="display:none">     
    <option value="1">An optinos</option>
  </select>
</div>

ui-screen-hidden是jquery移动定义的样式规则(在jquery.mobile..css中),用于隐藏元素.

ui-screen-hidden is a jquery mobile defined style rule (in jquery.mobile..css) for hiding an element.

这篇关于jQuery Mobile显示隐藏的选择元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆