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
2024-04-25 16:04

满意答案

我可能会使用这种方法

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

相关问答

更多

Rails - 有许多多个嵌套关联(Rails - Has Many multiple nested association)

如果您已经建立了关联 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 ad...

嵌套表单更新has-many parent AND创建一个* single *子对象(nested form to update has-many parent AND create a *single* child object)

如果要在父表单中显示新的单个子表单,可以执行以下操作: <%= 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 (或fi...

Rails:从has-many关联中获取所有关联模型(Rails: Get all associated models from has-many association)

我的想法是: 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 ...

Rails嵌套关联和重新编号(Rails nested association and restarted numbering)

这可能是相当多的工作,但基本上可以通过以下步骤来完成: 创建一个迁移来添加一个新属性来存储特定的用户发布计数。 (我用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[:...

无法通过rails 4视图中的has-many设置if else条件(unable to set if else conditions with has-many through association in rails 4 view)

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)

我可能会使用这种方法 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 pr...

错误:表单中有很多关系,更新时有重复数据(Error: has-many relationship in form, duplicate data when update)

在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. Witho...

Rails 5嵌套资源具有多个通过关联的URL(Rails 5 Nested Resources Urls with Has-Many Through Association)

对于路线: location_category_path GET /locations/:location_id/categories/:id(.:format) 你需要几个东西,位置id对象和类别id对象: <!-- /locations/:location_id/categories/:id --> <%= link_to 'Show', [{location_id}, {category_id}] %> For the route: location_category_path...

多态关联和嵌套属性(Polymorphic association and nested attributes)

您可能需要更改 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, :pi...

Rails查询与嵌套关联和组(由关联对象)(Rails Query with nested association and group ( by associated object))

通过向模型添加另一个关联可以使这更容易: # 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)...

相关文章

更多

BootStrap入门教程 (一)

2011年,twitter的“一小撮”工程师为了提高他们内部的分析和管理能力,用业余时间为他们的产品构 ...

Solr: a custom Search RequestHandler

As you know, I've been playing with Solr lately, tr ...

BootStrap入门教程 (二)

上讲回顾:Bootstrap的手脚架(Scaffolding)提供了固定(fixed)和流式(flui ...

BootStrap入门教程 (四)

上讲回顾:Bootstrap组件丰富同时具有良好可扩展性,能够很好地应用在生产环境。这些组件包括按钮( ...

BootStrap入门教程 (三)

上讲回顾:Bootstrap的基础CSS(Base CSS)提供了优雅,一致的多种基础Html页面要素 ...

Custom SOLR Search Components - 2 Dev Tricks

I've been building some custom search components fo ...

Hadoop0.20+ custom MultipleOutputFormat

Hadoop0.20.2中无法使用MultipleOutputFormat,多文件输出这个方法。尽管0 ...

My W3C Custom Mapping File

[hdhw] HotKey=W Tip=Train Dragonha|cffffcc00w|r ...

[How to] Make custom search with Nutch(v 1.0)?(转)

http://puretech.paawak.com/2009/04/29/how-to-make-c ...

Bootstrap基础视频教程-尚学堂视频教程

内容包括Bootstrap起步、Bootstrap全局css样式概览、Bootstrap全局css样式 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本