将此列表变为下拉列表?

时间:2015-04-28 03:55:39

标签: categories html.dropdownlistfor

所以我一直在玩这个人的教程,把每个人的元素都带到一个应用程序中。 https://mackenziechild.me/12-in-12/

在这个特定教程https://mackenziechild.me/12-in-12/7/中,我们使用rails控制台创建类别

现在因为我将它添加到他的reddit克隆之上,在他的博客中添加了一个侧边栏,我不能复制粘贴他的application.html.erb(他在这一个中使用了haml,但他的前两个我复制了使用了erb,所以我坚持使用它而不是重写所有东西)

我的问题在于,我修改了application.html中的类别,因为2小时不能让它们变得漂亮,所以我只是在类别行上放了列表标签,因为这是我能想到的唯一方法它有点工作

但是现在我想在我现有的4个类别之上添加更多类别,此时类别列表将占用太多空间,我认为下拉列表很好,但无法弄清楚< / p>

在application.html中我得到了

<div id="content" class="col-md-9 center-block">
<% Category.all.each do |category| %>
  <li><%= link_to category.name, links_path(category: category.name) %></li>
<% end %>

我该怎么办?

1 个答案:

答案 0 :(得分:0)

this.fullScreenMode = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen; console.log("initial fullScreenMode: " + this.fullScreenMode); $(document).on('mozfullscreenchange webkitfullscreenchange fullscreenchange', function() { console.log('fullscreenchange Event fired'); this.fullScreenMode = !this.fullScreenMode; console.log('fullScreenMode: ' + this.fullScreenMode); if (!this.fullScreenMode) { console.log('we are not in fullscreen, do stuff'); $('.sp-layer').css('width', '100%'); } }); $('a.sp-video').on('click', function() { console.log('clicked on link'); console.log('fullScreenMode: ' + this.fullScreenMode); if (this.fullScreenMode) { console.log('we are fullscreen, do stuff'); var cW = $(this).children('img')[0].clientWidth; console.log('clientWidth of image: ' + cW); $(this).parent('.sp-layer').css('width', cW); } });

您可以详细了解here