[英]Flexslider slide white space
I'm using Flexslider, and encountering a strange problem: every slide is shifted to the right, with a portion of white space on the left side of each slide. 我正在使用Flexslider,遇到一个奇怪的问题:每张幻灯片都向右移动,每张幻灯片的左侧都有一部分空白。
When I try to inspect the DOM, I find that temporary fix is to either remove float: left
or margin-right: -100%
that's in li
's inline style - BUT it breaks the sliding afterwards. 当我尝试检查DOM时,我发现临时解决方法是删除
float: left
或margin-right: -100%
,这是li
的内联样式- 但此后它会打破滑动。 What happens is that when you click arrow for the next slide, it shifts the first one down, shows the second, and then hides the first one. 发生的事情是,当您单击下一张幻灯片的箭头时,它将第一张幻灯片向下移动,显示第二张幻灯片,然后隐藏第一张幻灯片。
If I don't intervene in anyway with inline styles, slider still has white space to the left, and after I scroll down the page and return up, the slider works as expected, with no problem. 如果我仍然不使用内联样式进行干预,则滑块仍会在左侧留有空白,并且在我向下滚动页面并返回时,滑块会按预期工作,没有问题。
Note that I don't have this problem on 1920x1080 resolution, but on lower - 1024x768 for example. 请注意,我在1920x1080分辨率上没有这个问题,但是在较低的分辨率上(例如1024x768)。
What could be the problem? 可能是什么问题呢? Also, here's a link to live demo: http://goo.gl/RGS4O
另外,这是实时演示的链接: http : //goo.gl/RGS4O
I have added at flexslider.resize()
function in start option and it works fine. 我在开始选项的
flexslider.resize()
函数中添加了它,并且工作正常。
$('.flexslider').flexslider({
start: function(slider){
$('body').removeClass('loading');
$('.flexslider').resize();
}
});
On some projects lately I occasionally get some issues with a flexslider image gallery on my webpage adding some strange extra white margins. 最近,在某些项目中,我的网页上偶尔会遇到一些关于flexslider图片库的问题,这增加了一些奇怪的额外白色边距。 (Like 50-100px or so of white space) on either the entire lefthand, or entire righthand side.
(在整个左侧或整个右侧)(例如50-100px左右的空白)。
I ended up changing some of the css
rules inside flexslider.css
(specifically for version 2.2.0) I believe it was caused by how the navigation arrows are hidden and shown, specifically their CSS. 我最终更改了
flexslider.css
(特定于版本2.2.0)中的某些css
规则,我认为这是由隐藏和显示导航箭头(尤其是其CSS)的方式引起的。
I changed/merged some CSS for how the arrows appear, making them permanent: 我更改/合并了一些CSS,以了解箭头的显示方式,使它们永久存在:
.flex-direction-nav .flex-prev { opacity: 1; left: 10px; }
.flex-direction-nav .flex-next { opacity: 1; right: 10px; text-align: right; }
I removed the following css
regarding the arrows using a media query: 我使用媒体查询删除了有关箭头的以下
css
:
@media screen and (max-width: 860px) {
.flex-direction-nav .flex-prev { opacity: 1; left: 10px;}
.flex-direction-nav .flex-next { opacity: 1; right: 10px;}
}
I feel this issue of white space is also discussed well here. 我觉得这个空白问题在这里也讨论得很好。 https://drupal.org/node/1695136
https://drupal.org/node/1695136
It may be CSS. 可能是CSS。 Try adding
max-width: 100%; height: auto
尝试添加
max-width: 100%; height: auto
max-width: 100%; height: auto
on the images. max-width: 100%; height: auto
显示图像。
$('.flexslider').flexslider({
useCSS: false
});
Add this line in your configuration it will work properly. 在配置中添加此行,它将可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.