Css Rails 4的内容单元未加载
我的application.html.erb中有这个Css Rails 4的内容单元未加载,css,ruby-on-rails,ruby-on-rails-4,content-for,Css,Ruby On Rails,Ruby On Rails 4,Content For,我的application.html.erb中有这个 <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <%= stylesheet_link_tag "application","jquery.mobile-1.4.5" %> <%= javascript_include_tag "application","jquery.m
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= stylesheet_link_tag "application","jquery.mobile-1.4.5" %>
<%= javascript_include_tag "application","jquery.mobile-1.4.5" %>
<%= csrf_meta_tags %>
<%= yield(:head) %>
</head>
我的主/index.html.erb文件包含以下内容:
<%= content_for :head do %>
<style type="text/css">
body {
display: table;
position: relative;
width: 100%;
height: 100%;
background: url(/assets/main/background.jpg) no-repeat center center scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.center-wrapper{
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
.ui-page {
background: transparent;
}
.ui-content{
background: transparent;
}
</style>
<% end %>
身体{
显示:表格;
位置:相对位置;
宽度:100%;
身高:100%;
背景:url(/assets/main/background.jpg)无重复中心滚动;
-webkit背景尺寸:封面;
-moz背景尺寸:封面;
背景尺寸:封面;
-o-背景尺寸:封面;
}
.中心包装{
保证金:0自动;
文本对齐:居中;
垂直对齐:中间对齐;
}
.ui页面{
背景:透明;
}
.ui内容{
背景:透明;
}
这是根url并正确加载。在此之后,如果我导航到任何其他url,比如vendors/index.html.erb,则由于(main/index.html.erb)的内容而生成的css不会清除
我试图通过更改body中使用的背景图像,在vendors/index.html.erb中添加一些css。但是,它没有得到反映。它仍在使用因main/index.html.erb中的内容而生成的css。问题是我使用的是jquery mobile,它的工作方式与TurboLink相同。它只是在重新加载中包含的页面部分
<div data-role="page">
.......
</div>
您正在使用TurboLink吗?将
替换为
^^^^^这是正确答案。@patrick中的相等项不,我没有使用turbolinks@vee还是一样。此外,我注意到在重新加载页面之前,它不会加载vendors/index.html.erb中的内容。它不知怎么跳过了这个街区。
rel="external", data-ajax="false" or target attributes