开发者

jcarousel: resize window moves carousel out of view

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开发者_JAVA技巧 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
    }); 
 });


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

It looks like in your CSS the width of the list items for the carousel is being set to 178px and the actual images within them are 185px wide. Adjusting the width of the ".jcarousel-skin .jcarousel-item" to 185px (and adjusting any margins accordingly) should do the trick.


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.

 drupal_get_path('module', 'jcarousel') . '/js/jquery.jcarousel.js',

After that instead of this on line 287 of jquery.jcarousel.js... if (i + 1 < self.first) {

replace it to this...

if (i + 1 < self.first % this.options.size) {

All the best...

It worked for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜