2

I am trying out Products.Carousel. I created a Carousel for my homepage,and added two Banners, which rotate automatically after n seconds.

Problem is I am supposed to set the width and height in the Carousel settings, or leave those values blank to use the ones for the first banner.

What I wished is that the carousel used the same width for the main content area. I tried to set a fixed value, but of course it won't work in different resolutions (the banners might invade the right portlet area, or might be too short for the main content width).

Any ideas on how I can work this around?

4

2 回答 2

2

您应该能够通过覆盖 Products.Carousel.viewlet(在文件系统代码或 portal_view_customizations 中)为轮播赋予可变宽度。您可能希望轮播宽度基于另一个元素的宽度,例如#content div:

<div tal:condition="view/available"
    tal:attributes="id view/element_id;"
    class="carousel">
    <tal:banners tal:define="banners view/banners;"
        tal:condition="banners"
        tal:content="structure banners">
        Banners
    </tal:banners>
    <tal:pager tal:define="pager view/pager;"
        tal:condition="pager"
        tal:content="structure pager">
        Pager
    </tal:pager>
    <script type="text/javascript" charset="utf-8" tal:content="string:
        (function ($$) {
            $$('#${view/element_id}').ploneCarousel({
                height: ${view/height},
                width: $$('#content').width(),
                transition: '${view/transition}',
                speed: ${view/speed},
                delay: ${view/delay}
            });
        })(jQuery);
    ">
    </script>
</div>
于 2011-03-17T13:18:54.343 回答
0

我没有答案,只有想法。

  • 您可以在横幅区域设置一个类,将其宽度设置为与主要内容区域相同吗?
  • 你可以使用 % 宽度吗?

或我使用的邪恶但成功的方法:

  • 使用 swfobject.js 的 flash 横幅
于 2011-03-17T12:51:59.737 回答