问题标签 [select-menu]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1665 浏览

css - 如何在 jQuery Mobile [使用固定标题工具栏] 中设置(选择菜单)覆盖的偏移量?

有没有办法定义 JQM 用于选择菜单覆盖的偏移量?

其他选项可以通过原型设置,如下所示:

问题描述

jQuery Mobile 确定屏幕的大小并决定如何显示选择菜单的覆盖。不幸的是,这似乎只在不使用固定标题工具栏的情况下才有效,因为 JQM 总是在此处生成顶部偏移量为 30px 的源代码style="left: 741.65px; top: 30px;

没有办法只用 CSS 覆盖它,因为 css 规则的特殊性总是低于样式属性的特殊性!

我不想更改 JQM 源代码,因为我必须在每次发布时再次更改它。而且我不使用未压缩的源。

从 JQM 生成的源代码

样本

http://jsfiddle.net/V8AAB/

JQM源代码

这是来自 jQuery Mobile 1.0RC2 的相应代码:

0 投票
2 回答
13573 浏览

jquery-ui - jQuery UI SelectMenu Dropdown - 打开 UP 而不是 DOWN

我正在使用jQuery UI 选择菜单,偶尔会遇到一些问题。

它位于我的用户页面的左上角。使用“下拉/地址”类型,有时(似乎是随机的),下拉菜单打开而不是向下,除了第一个选项之外,您无法选择其中的任何选项,因为它都在屏幕“上方”。

有人知道那里有一个设置/选项来强制它打开吗?谢谢!

更新.... 11/23/11 1:11pm EST 这是调用的一些代码:

0 投票
1 回答
151 浏览

javascript - 多选菜单一个数据源

寻找一个基于 jQuery 的选择菜单,它使用中央数据源,因此我不必在页面上包含 500 次国家选项,只需一次。野外有这样方便的东西吗?

0 投票
1 回答
978 浏览

ruby-on-rails - 带有 Rails grouped_collection_select 的 jQuery Selectmenu

我一直在玩 jQuery-ui Selectmenu,但无法让它与grouped_collection_select. 当我将类设置为“selectmenu”时,Selectmenu 与基本选择一起使用,我已将 jQuery-ui 设置为要查找的。基本上,我正在努力将 Class 添加到grouped_collection_select.

我试过了: <%= f.grouped_collection_select(:state_id, Country.order(:id), :categories, :name, :id, :name, {:include_blank=>true, :class=>"selectmenu"})%>

<%= f.grouped_collection_select(:state_id, Country.order(:id), :categories, :name, :id, :name, :class=>"selectmenu")%>

我能够在我的咖啡脚本中使用 $('#user_state_id).addClass('selectmenu') 添加类。但是,这似乎导致我的动态菜单无法更新我的状态选择菜单的选项。

关于我在这里缺少什么的任何想法?有没有更好的方法来设置 grouped_collection_select 的类。我已经检查了源代码,并且没有使用 :class=> in 添加该类grouped_collection_select

选择菜单:http : //jquery-ui.googlecode.com/svn/branches/labs/selectmenu/index.html

0 投票
1 回答
985 浏览

javascript - 当嵌入到“可见”绑定中时,jQuery 选择菜单不能与 knockout.js 一起使用

我有一个 jsfiddle 演示了这个问题:http: //jsfiddle.net/michaelajohnsonwa/sDchM/7/

隐藏时从选择中生成的下拉元素似乎没有正确生成。我尝试使用“选项”绑定和自定义 jqOptions 绑定。我尝试将 .selectmenu('refresh') 添加到组合中,但结果没有区别。自定义绑定在模板绑定中使用时不起作用,我也觉得这很奇怪。

我不确定这是否是 jQuery selectmenu 或 knockout.js 的问题。

--edit:刚刚发现工作代码在 IE 中不起作用。Chrome 和 Firefox 确实准确地证明了这个问题。

这里的任何帮助都将得到应用!谢谢!!

0 投票
2 回答
143 浏览

jquery - 提交选择菜单

我在 jQuery Mobile 中使用代码来动态生成选择菜单,但在将数据传递到数据库时遇到了问题。菜单是使用append每个表单元素的方法生成的。这是一个简短的代码示例:

我知道这不是最好的代码。

我遇到的问题是我不知道如何获取提交的数据。如果我应该使用表单标签,我很困惑。

真的需要吗?我应该使用<button>标签还是使用<input>标签?

单击提交时我应该使用一个函数,还是应该使用 jQuery 库中的一些东西?

此处生成的 HTML:

我还制作了一个 JSFiddle 来向您展示它的实际外观

我得出结论,我应该运行一个函数。但是,我怀疑serialize()做我想要的,所以像:

但是我仍然需要所选元素本身的名称/ID。准备好插入 SQL 数据库时,代码会是什么样子?

0 投票
3 回答
1197 浏览

jquery-mobile - Is there any way to control the layout of the close button on a jQuery Mobile custom select menu?

I have a custom select menu (multiple) defined as follows:

Everything works fine except that I want to move the header's button icon over to the right AND display the Close text. (I have found some mobile users have a problem either realising what the X icon is for or they have trouble clicking it, so I want it on the right with the word 'Close' making too big to miss.) There don't seem to be any options for doing that on the select since its options apply to the select bar itself.

I have tried intercepting the create event and in there, finding the button anchor and adding a create handler for that, doing something like this (I have tried several variations, as you can see by the commenting out):

So I have tried resetting the button options and calling refresh (didn't work), and changing the CSS. Neither worked and I got weird formatting issues with the close icon having a line break.

Anyone know the right way to do this?

0 投票
2 回答
814 浏览

php - PHP获取多选列表值

我正在尝试编写一个简单的函数来构造表单的字段名称。如果在多选列表中选择了至少一个值,则它工作正常,但如果未选择任何值,我会收到未定义的索引错误。这是我所拥有的:

}

谢谢!

0 投票
1 回答
664 浏览

jquery - jquery ui selectmenu + jscrollpane 麻烦

这是我一起使用“jquery ui selectmenu”和“jscrollpane”时的一些问题。

鼠标滚轮效果很好,但如果我点击滚动窗格(“.jspDrag”),这里就是粘滞鼠标。

您可以在下面的链接中看到:

http://htmlfabric.ru/test/

谢谢!

0 投票
1 回答
1402 浏览

jquery - 自定义选择菜单,jQuery 不工作

我正在尝试通过制作自定义菜单来复制标准选择菜单的功能。

问题是我不能让它表现得像一个选择菜单。我的目标是能够在单击列表项时替换“选定”文本。每当用户在菜单外单击时,我也试图关闭菜单。

这是我的 JS Fiddle 的链接:

http://jsfiddle.net/dg7Lc/9/

我感谢任何见解!谢谢!

-D