- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近一直在使用 jQuery Mobile,并且开始遇到各种限制;其中大部分我可以使用某种 jQuery/Javascript/CSS 操作来解决。我们使用了很多 iPad,它比普通手机更宽。我们页面上的一些输入组往往以两列格式看起来更好;可能的话。
一个例子是一长串单选按钮。仅在一列中看起来很糟糕。我们希望以 2 或 3 列显示单选按钮列表,而不是使用单个“垂直”“控制组”获得的典型 1 列格式。请参阅此演示页面上的垂直控制组:
http://demos.jquerymobile.com/1.4.5/checkboxradio-radio/#Verticalgroup
对于复选框,我通过创建两个或三个不同的控制组然后将它们放入一个 3 列网格中来完成此操作。这适用于复选框,但我不确定如何使用单选按钮执行此操作。有什么想法吗?
我假设我可以创建三个不同的 radio 输入垂直控制组(并排),然后操纵 CSS 使它看起来像一个组。我必须为实际选择的 radio 管理一个隐藏的输入。
最佳答案
我决定为营销来源创建两列;右边和左边。名称是“marketing_source_left”和“marketing_source_right”。我填充了两个 radio 垂直控制组,然后使用 jQuery 将两者更改为仅具有“marketing_source”的“name”属性。
// Define current marketing_source value and remove hidden field
var marketing_source = $('#marketing_form #marketing_source').val(); // hidden field
$('#marketing_form #marketing_source').val(marketing_source).remove();
// Change all marketing source radios (left and right sides)
// to have property name="marketing_source"
$("#marketing_form input:radio[name='marketing_source_left']").prop('name', 'marketing_source').prop('checked', false);
$("#marketing_form input:radio[name='marketing_source_right']").prop('name', 'marketing_source').prop('checked', false);
// Set the radio to checked for the marketing source value
$('#marketing_form input[type="radio"]:checked').prop('checked', false); // Uncheck current
$('#marketing_form input:radio[name="marketing_source"]').filter('[value="'+marketing_source+'"]').prop('checked', true);
$('#marketing_form input:radio[name="marketing_source"]').checkboxradio('refresh');
使用的 CSS 与此类似。
#marketing_right_div, #marketing_left_div {
display: inline-block !important;
width: 314px !important;
text-align: top;
vertical-align: top;
}
关于php - jQuery 手机 : Two/three column vertical control group of radio buttons,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35706871/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!