首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >carouFredSel响应高度

carouFredSel响应高度
EN

Stack Overflow用户
提问于 2012-11-01 23:36:22
回答 14查看 43.7K关注 0票数 16

我在使用carouFredSel时遇到了响应式传送带的高度问题。

因为图像是响应性的,并且轮播也被设置为响应性。

它仍然会将图像的最大高度添加到div。

当我的图像宽度为740,高度为960时。它将图像调整到响应的宽度以适应屏幕,图像也会重新缩放以适应宽度,但div似乎仍然认为存在高度为960的图像。

如何解决此问题?

EN

回答 14

Stack Overflow用户

回答已采纳

发布于 2012-11-02 00:01:29

我不久前偶然发现了这个问题;我找到的唯一解决方案是在调整浏览器大小时调整容器的大小。它确实起了作用,但我内心的书呆子并不太喜欢它。

我只引用了转盘,并添加了onCreate函数:

代码语言:javascript
复制
var $carousel = $("#swiper");

$carousel.carouFredSel({
  width: "100%",
  height: "auto",
  responsive: true,
  auto: true,
  scroll: { items: 1, fx: 'scroll' },
  duration: 1000,
  swipe: { onTouch: true, onMouse: true },
  items: { visible: { min: 4, max: 4 } },
  onCreate: onCreate
});​

function onCreate() {
  $(window).on('resize', onResize).trigger('resize');
}

function onResize() {
  // Get all the possible height values from the slides
  var heights = $carousel.children().map(function() { return $(this).height(); });
  // Find the max height and set it
  $carousel.parent().add($carousel).height(Math.max.apply(null, heights));
}

如果您在2015年仍在使用此插件,那么是时候继续使用它了。

免费版不再受支持,商业版现在是Wordpress插件。此外,如今谁需要修改滑块才能使其具有响应性?

票数 32
EN

Stack Overflow用户

发布于 2013-07-25 12:01:22

对我有效的方法(甚至早在我的模板6.0.3版本之前):

在项目和主选项中设置高度:'variable‘,如下所示:

代码语言:javascript
复制
    $('#foo').carouFredSel({
    responsive: true,
    width: '100%',
    height: 'variable',
    items: {
        height: 'variable'
    }
});

我可以在任何时候调整大小,而不再裁剪DIVs中的文本。

票数 24
EN

Stack Overflow用户

发布于 2013-09-23 23:41:53

代码语言:javascript
复制
$('#foo2').carouFredSel({
      responsive: true,
      auto: true,
      width: "100%",
      height: "100%",
      scroll: 3,
      prev: '#prev4',
      next: '#next4',
      items: {
        width: '100%',
        height: '100%'
      }
    }).trigger('resize');
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13180445

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档