Bootstrap 3 - 在折叠时以自定义方式重新排列列中的div(Bootstrap 3 - rearranging divs within columns in a custom way on collapse)
这有点难以解释,所以请参考下面的视觉辅助工具。
当前桌面版 - > http://i.stack.imgur.com/SdNp4.png
当前手机版 - > http://i.stack.imgur.com/CjddY.png
所需的移动版本 - > http://i.stack.imgur.com/7hxxl.png
JSBin - > http://jsbin.com/wisurozilo/1/edit?output
我不确定这样做的最好方法,因为我是一名PHP / MySQL开发人员,这需要客户端专业知识。 关于如何获得所需移动版本的任何建议?
没有要求将div组合在一列中,只是它们以所需方式呈现的方式崩溃。
This is sort of difficult to explain, so please refer to the visual aids below.
Current Desktop Version -> http://i.stack.imgur.com/SdNp4.png
Current Mobile Version -> http://i.stack.imgur.com/CjddY.png
Desired Mobile Version -> http://i.stack.imgur.com/7hxxl.png
JSBin -> http://jsbin.com/wisurozilo/1/edit?output
I'm not sure of the best way to do this as I am a PHP/MySQL developer and this defintely requires client-side expertise. Any suggestions on how I can get the Desired Mobile Version?
There is no requirement to combine the divs within one column, just that they collapse in a way that is presented in the desired fashion.
原文:https://stackoverflow.com/questions/31215434
最满意答案
我可能会使用这种方法
words = params[:some_word_list] @list = List.new # List.find() if you're updating @list.words = [] if @list.persisted? words.each do |w| word = Word.find_or_create_by(:word => w) @list.words << word end @list.save
希望能帮助到你
I would probably use this approach
words = params[:some_word_list] @list = List.new # List.find() if you're updating @list.words = [] if @list.persisted? words.each do |w| word = Word.find_or_create_by(:word => w) @list.words << word end @list.save
Hope it helps
相关问答
更多-
如果您已经建立了关联 A有很多B,而B有很多C 然后你们都成立了。 唯一要做的就是添加以下代码(不需要更改数据库): class A has_many cs, through: :bs end 并使用a_object.c_objects 。 If you already have established the associations A has many B, and B has_many C then you are all set up. Only thing to do is adding ...
-
如果要在父表单中显示新的单个子表单,可以执行以下操作: <%= simple_form_for @parent do |p| %> <%= p.input :parent_attribute %> <%= p.simple_fields_for :child, @child do |c| %> <%= c.input :child_attribute %> <% end %> <% end %> 请注意,您必须同时指定子模型名称以及simple_fields_for (或fields_ ...
-
我的想法是: Post.joins(:post_tags).where('post_tags.tag_id' => some_ids).uniq 您可以将其作为更容易重用的范围。 我不认为有这种情况的内置方法。 My thought is: Post.joins(:post_tags).where('post_tags.tag_id' => some_ids).uniq You can make it a scope for easier reuse. I don't think there is a ...
-
这可能是相当多的工作,但基本上可以通过以下步骤来完成: 创建一个迁移来添加一个新属性来存储特定的用户发布计数。 (我用user_post_id ) 覆盖Post的to_param方法以使用刚刚创建的新值。 (它必须是一个字符串。) to_param是url和path助手使用的方法。 创建一个before_save过滤器,它将实际增加每个新帖子的user_post_id值。 更改所有控制器方法以在user_post_id上user_post_id @user = User.find(params[:user_ ...
-
collect创建一个包含块返回的值的新数组。 您有一个employee_inventories的状态为'ALLOTTED',并且因为您在collect块中检查它: e.status == 'ALLOTTED' #=> true ,它创建一个布尔true的数组: [true] 。 要解决您的问题,您可以这样做: inventory.employee_inventories.collect{|e| e.status }.include? 'ALLOTTED' 或检查是否有任何一个员工库存设置为分配(如果这是 ...
-
基于嵌套对象存在修改has-many中的关联(Modifing association in has-many through based on nested object existance)[2022-04-14]
我可能会使用这种方法 words = params[:some_word_list] @list = List.new # List.find() if you're updating @list.words = [] if @list.persisted? words.each do |w| word = Word.find_or_create_by(:word => w) @list.words << word end @list.save 希望能帮助到你 I would probabl ... -
在product_params中,您应该指定options_products_attributes的id。 没有id,属性将被新添加到产品模型中。 所以,试试...... options_products_attributes:[:id,price,:stock,variant_attributes:[:id,:tipoVariant,... In product_params, you should specify id of options_products_attributes. Without id ...
-
Rails 5嵌套资源具有多个通过关联的URL(Rails 5 Nested Resources Urls with Has-Many Through Association)[2023-02-07]
对于路线: location_category_path GET /locations/:location_id/categories/:id(.:format) 你需要几个东西,位置id对象和类别id对象: <%= link_to 'Show', [{location_id}, {category_id}] %> For the route: location_category_path GET ... -
您可能需要更改 params.require(:product).permit(:name, :sharable, :givable, image_attributes: [:name, :picture_file_name, :picture_content_type, :picture_file_size]) 至 params.require(:product).permit(:name, :sharable, :givable, images_attributes: [:name, :picture ...
-
Rails查询与嵌套关联和组(由关联对象)(Rails Query with nested association and group ( by associated object))[2022-04-29]
通过向模型添加另一个关联可以使这更容易: # company.rb has_many :users has_many :orders, through: :users 然后你可以这样做: companies = Company. joins(:orders). group("company.id"). select("company.id, company.name, count(orders.id) as o ...