【问题标题】:Responsive bootstrap not working on mobile in rails project响应式引导程序不适用于 Rails 项目中的移动设备
【发布时间】:2018-02-19 18:39:03
【问题描述】:

我在 Rails 上使用 devise gem

如果按下选择表单按钮表单下拉溢出屏幕大小,选择表单无法正常工作请帮助我。

views/registration/new.html.erb

<div class="field">

    <%= f.label :Industry_Type %> : </b><br />
    <%= f.select :industry,options_for_select([["Select One", ""],
                                            'Automobiles & Transportions', 
                                            'Computer & Telecommunication', 
                                            'Electronics', 
                                            'Electrical']),{},
                                            {class: "form form-group form-control"}%>
</div>

【问题讨论】:

  • 您需要发布您的输出 HTML。当前的代码sn -p 对调试没用。
  • 同意。您能否详细说明“无法正常工作”-您观察到什么?你希望看到什么?

标签: html css ruby-on-rails twitter-bootstrap


【解决方案1】:

尝试以下方法,它工作正常

<%= f.select :industry, [["Select One", " "], 
                        ["Automobiles & Transportions"], 
                        ["Computer & Telecommunication"], 
                        ["Electronics"], ["Electrical" ]],{}, 
                        class: 'form form-group form-control'%>

生成的 HTML 代码

<select class="form form-group form-control" name="user[industry]" id="user_industry">
    <option value=" ">Select One</option>
    <option value="Automobiles & Transportions">Automobiles & Transportions</option>
    <option value="Computer & Telecommunication">Computer & Telecommunication</option>
    <option value="Electronics">Electronics</option>
    <option value="Electrical">Electrical</option>
</select>

问题更新后编辑

当你使用 100% 时,它会正确显示你必须看到 45% 将这个 45% 更改为 100%

【讨论】:

  • 哦! @adarsh 这不是问题,当您使用笔记本电脑或台式机测试设备然后显示您共享的照片时,但是当您真正使用各种设备(如三星、iPhone、oppo 等)时。然后就像我分享的照片一样,这是我的答案
  • 在顶部,当您使用 100% 时,它会正确显示您必须看到 45% 将这个 45% 更改为 100%
  • 好的,我用手机查了一下,谢谢你帮我解答
猜你喜欢
  • 2018-09-20
  • 1970-01-01
  • 1970-01-01
  • 2018-05-16
  • 1970-01-01
  • 2014-10-25
  • 1970-01-01
  • 1970-01-01
  • 2021-04-09
相关资源
最近更新 更多