这个问题在这里已经被问过很多次了,我已经遵循了所有给出的答案,但是都没有用。我被<h2 class="text-center">
Title: <%= @article.title %>
</h2>
<div class="well col-xs-8 col-xs-offset-2">
<div id="user-info-showpage" align="center">
Created by: <%= render 'shared/user-info', obj: @article.user %>
</div>
<h4 class="text-center">
<strong>Description:</strong>
</h4>
<hr />
<%= simple_format(@article.description) %>
<% if @article.categories.any? %>
<p>Categories: <%= render @article.categories %></p>
<% end %>
<div class="article-actions">
<% if logged_in? && (current_user == @article.user || current_user.admin?) %>
<%= link_to "Delete", article_path(@article), method: :delete,
data: {confirm: "Are you sure you want to delete the article?"},
class: 'btn btn-xs btn-danger' %>
<%= link_to "Edit", edit_article_path(@article), class: 'btn btn-xs btn-success'%>
<%end%>
<%= link_to "View All Articles", articles_path , class: 'btn btn-xs btn-primary'%>
</div>
</div>
<% if logged_in? %>
<div class="col-xs-8 col-xs-offset-2">
<%#= render partial: 'comments/form', :locals => {commentable: @article} %>
</div>
<%end%>
<div class="col-xs-8 col-xs-offset-2">
<div id="comments"></div>
<%= @article.comments.inspect %>
<% @article.comments.each do |c| %>
<div class="well">
<%= c.content %> by
<%= c.commenter %>
</div>
<%end%>
<div id="comments"></div>
</div>
滑块的'scrollHorz'所困扰。以下是其 HTML :
jQuery cycle
CSS 是:
<div id="cycleNav"></div>
<div id="wrapper">
<div id="container">
<div id="prev"></div>
<div id="prevOpacity"></div>
<div id="dvPauseContainer" class="playing" data-is-paused="0"></div>
<button id="pause"></button>
<div id="pauseOpacity"></div>
<div id="slider" class="playing" data-is-paused="0">
<img src="~/XImages/1.jpg" width="900" height="350" alt="Flight 1">
<img src="~/XImages/2.jpg" width="900" height="350" alt="Flight 1">
<img src="~/XImages/3.png" width="900" height="350" alt="Flight 1">
<img src="~/XImages/4.png" width="900" height="350" alt="Flight 1">
</div>
<div class="controller" id="next"></div>
<div class="controller" id="nextOpacity"></div>
</div>
</div>
我正在使用的和 javaScript 是:
#wrapper {
height: 350px;
position: relative;
right: 0;
top: -120px;
}
#container {
overflow: auto;
}
#slider {
height: 350px;
width: 980px;
overflow: hidden;
position: relative;
top: 0px;
left: 0px;
}
#slider > img {
left: 40px !important;
}
#prev {
background-image: url(/XImages/prev1.png);
background-repeat: no-repeat;
background-position: center center;
height: 50px;
width: 50px;
position: relative;
left: 0px;
top: 350px;
z-index: 99;
}
#prevOpacity {
background-color: white;
display: block;
height: 50px;
width: 50px;
position: relative;
z-index: 98;
top: 300px;
left: 0;
opacity: 0.5;
border-radius: 0px 25px 25px 0px;
}
#next {
background-image: url(/XImages/next1.png);
background-repeat: no-repeat;
background-position: center center;
float: right;
height: 50px;
width: 50px;
position: relative;
z-index: 97;
bottom: 183px;
right: 0;
border-radius: 25px 0px 0px 25px;
}
#nextOpacity {
background-color: white;
float: right;
height: 50px;
width: 50px;
position: relative;
z-index: 96;
bottom: 183px;
left: 50px;
opacity: 0.5;
border-radius: 25px 0px 0px 25px;
}
#dvPauseContainer {
position: relative;
top: 425px;
height: 40px;
width: 40px;
background-repeat: no-repeat;
background-position: center center;
z-index: 94;
margin-left: auto;
margin-right: auto;
}
#pause {
background-color: transparent;
height: 40px;
width: 40px;
position: relative;
top: 385px;
left: 470px;
z-index: 94;
border: 1px ridge white;
opacity: 0.5;
}
#dvPauseContainer.paused {
background-image: url(/XImages/play1.png);
}
#dvPauseContainer.playing {
background-image: url(/XImages/pause1.png);
}
#cycleNav {
height: 16px;
position: relative;
top: 65px;
left: 440px;
}
a.box {
background-color: #ccf;
display: block;
float: left;
width: 12px;
height: 12px;
margin: 2px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
a.activeSlide {
background-color: #8f8
}
此代码可与<script type="text/javascript">
jQuery(function ($) {
$('#slider').cycle({
fx: 'scrollHorz',
prev: '#prev',
next: '#next',
timeout: 0,
rev: true,
pager: '#cycleNav',
pagerAnchorBuilder: buildPagerBox
});
function buildPagerBox(i, el) {
return '<a href="#" class="box"></a>';
}
$('#pause').click(function () {
var slider = $('#dvPauseContainer');
var isPaused = slider.data('isPaused');
slider
.toggleClass('paused', !isPaused)
.toggleClass('playing', isPaused)
.data('isPaused', !isPaused);
$('#slider').cycle('toggle');
})
$('#slider').hover(
function () {
$(this).cycle('pause');
},
function () {
$(this).cycle('resume');
})
});
</script>
和fade
等其他效果配合使用。
有人可以帮我发现错误吗?提前致谢。
答案 0 :(得分:0)
您的CSS弄乱了插件。在问题消失之前,我一直在简化您的代码。当我删除CSS时,该插件开始工作。删除CSS,然后再添加回CSS,直到找到罪魁祸首为止。