jcarousel:调整窗口大小将轮播移出视图
我遇到了 jquery 插件 jcarousel 的问题,它会导致在调整浏览器大小时移动轮播区域。
当轮播设置为“循环”并且已经遍历完每个项目时,就会发生这种情况。 轮播的容器样式为left:-7300px;宽度:10950px; 当我调整浏览器大小时,它会更改为: left: -8030px;宽度:8760px;并且旋转木马不在视野中(似乎位于应有位置的左侧,因为我仍然可以看到项目滚动过去)。
编辑: 添加代码。我使用的是 Drupal + Views,所以 html 有点乱,无法真正发布。但这是我设置轮播的方式:
$(document).ready(function() {
$(".view-promo-box-home-page-carousel ul").jcarousel({
visible: 1,
scroll: 1,
auto : 1,
wrap : "circular",
itemFallbackDimension : 730
});
});
I'm having an issue with the jquery plugin jcarousel which causes the carousel area to be moved when the browser is resized.
This happens when the carousel is set to "circular" and has already gone through each item.
The container of the carousel has a style of left: -7300px; width: 10950px;
When I resize the browser it changes to: left: -8030px; width: 8760px; and the carousel is out of view (seems to be to the left of where it should be, as I can still see items scrolling past).
EDIT:
Adding code. I'm using Drupal + Views, so the html is a bit messy and can't really post. But here's how I'm setting up the carousel:
$(document).ready(function() {
$(".view-promo-box-home-page-carousel ul").jcarousel({
visible: 1,
scroll: 1,
auto : 1,
wrap : "circular",
itemFallbackDimension : 730
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道我迟到了,但是对于像我这样来此页面寻找答案的人来说,以下是来自的答案: http://www.sitepoint.com/forums/showthread.php?718555-Problem-with-Jcarousel
I know I'm late, but for persons like me, whom came to search for answer on this page, here's the answer from: http://www.sitepoint.com/forums/showthread.php?718555-Problem-with-Jcarousel
我尝试了很多,发现Jcarousel默认不包含jquery.jcarousel.js。因此,请尝试将以下行添加到modules/jcarousel 中的jcarousel.module 文件中。
之后,而不是 jquery.jcarousel.js 第 287 行上的这个...
if (i + 1 < self.first) {
将其替换为这个...
祝一切顺利...
它对我有用。
I tried a lot and found that, Jcarousel does not include the jquery.jcarousel.js by default. So try adding the following line to the jcarousel.module file in modules/jcarousel.
After that instead of this on line 287 of jquery.jcarousel.js...
if (i + 1 < self.first) {
replace it to this...
All the best...
It worked for me.