【发布时间】:2016-08-29 08:56:03
【问题描述】:
我已经寻找解决方案,但我没有发现与我相同的问题......
我的页面上有不同的部分,它们浮动在视图之外,如果您单击菜单链接,每个部分都会浮动到视图中。
猫头鹰轮播是一个额外的部分...现在的问题是,例如,当我在主页部分并调整窗口大小时。如果我让滑块部分浮入视野,猫头鹰旋转木马就会全部损坏。如果我再次调整窗口大小,轮播会重新加载,一切正常,但前提是我进行了额外的调整。
$(".menu-btn").click(function(event) {
var target = $(this).attr('href');
event.preventDefault();
$(".sectionID").removeClass("active");
$(target).addClass("active");
});
$("#owl-example").owlCarousel();
$(".slider").owlCarousel({
navigation: true,
pagination: true,
slideSpeed: 1000,
paginationSpeed: 500,
paginationNumbers: true,
singleItem: true,
autoPlay: false,
autoHeight: false,
animateIn: 'slideIn',
animateOut: 'slideOut',
afterAction: syncPosition,
responsiveRefreshRate: 200,
booleanValue: false,
afterMove: afterAction
});
.header {
position: fixed;
top: 0;
left: 0;
}
.active {
z-index: 2;
}
#menu-top {
position: fixed;
top: 0;
z-index: 1000;
}
.sectionID {
margin: 100px 0;
}
.sectionID:nth-child(odd) {
transform: translateX(-5000px);
}
.sectionID:nth-child(even) {
transform: translateX(5000px);
}
#section-wrapper {
position: relative;
}
.sectionID {
position: absolute;
top: 0;
transition: 1.5s;
padding-bottom: 0;
height: 100vh;
background-color: white;
}
.sectionID.active {
transform: translateX(0px);
width: 100%;
padding-bottom: 0;
background-color: white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<div class="header">
<ul>
<li><a href="#1" class="menu-btn">Home</a>
</li>
<li><a href="#2" class="menu-btn">Slider</a>
</li>
</ul>
</div>
<section id="1" class="sectionID active">
<div class="screen1">
<h1 style="text-allign:center;">Home</h1>
</div>
</section>
<section id="2" class="sectionID">
<div class="slider">
<div id="owl-example" class="owl-carousel">
<div>Your Content</div>
<div>Your Content</div>
<div>Your Content</div>
<div>Your Content</div>
<div>Your Content</div>
<div>Your Content</div>
<div>Your Content</div>
</div>
</div>
</section>
我添加了一个 sn-p 以便更好地理解我的部分是如何工作的。 我认为这是因为轮播没有刷新或再次加载,所以我试图找到一个解决方案,点击菜单按钮开始猫头鹰轮播的刷新,但我不知道如何。似乎没有任何效果..
我使用了一个模板,它有一个较旧的 jquery 和 owl carousel 1,现在更新文件的工作量太大了。如果我只是更新 jquery 和 owl carousel,我认为该页面无法正常工作。还是我错了?
好吧,回到我的问题:是否有可能在点击时刷新猫头鹰轮播?
提前感谢您的帮助....
【问题讨论】:
-
“单击菜单按钮时,猫头鹰轮播开始刷新”是什么意思?我们在这里谈论的是动态数据吗?
-
抱歉,我的意思是,如果我点击菜单按钮幻灯片,我想刷新 owl carousel .. 这将是我的解决方案,所以在窗口调整大小后 owl carousel 将适合...
标签: jquery css owl-carousel