I'm using jCarousel with approximately 10 images in it. 10 images can't be displayed at once in a div with a given div. On some pages though, only 3 images are being displayed, so scrolling is impossible.
Still the scroll arrows (next/prev) are being displayed. Is there a way to hide them autimatically if there's no overflow?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | jcarousel_disabled_buttons.patch | 5.01 KB | quicksketch |
| #5 | Block: style options | 104.8 KB | knalstaaf |
| #3 | 10 images, 5 shown, enough to scroll | 167.04 KB | knalstaaf |
| #3 | 4 images, 5 shown, no need to scroll (and to show arrows either) | 123.56 KB | knalstaaf |
Comments
Comment #1
knalstaaf commented"a div with a given width", ofcourse.
Comment #2
quicksketchThe default skin does not show arrows if there is no scrolling. You can do the same in your CSS with the following:
Comment #3
knalstaaf commentedI'm sorry, I wasn't specific enough. It's indeed so that if scrolling-function disabled in the options altogether, then it won't show the arrows.
But what I actually mean is: if scrolling-function ìs enabled, but on a certain page there are too little images to scroll through, could it hide the arrows automatically?
I've copy pasted the code you provided in my stylesheet just to make sure that it wouldn't solve the problem, but it didn't. So I guess there was a small misunderstanding of the question.
I've attached some screenshots to illustrate where I'm going to.
Comment #4
quicksketchI'm not following what you mean by the "scrolling function". Do you have this carousel's "Wrap" setting to be "Circular"?
Comment #5
knalstaaf commentedNo, it's actually set to "Both"; and "Number of visible items" is set to 5.
So in pages with let's say 10 images, it should show the arrows (as it already does correctly). But on a page with only 3 images, there's no need for the arrows, since one can't browse through them (all the images are already visible).
Comment #6
quicksketchjCarousel already does this if there is only one item, but it could possibly be expanded to do this behavior based on any number of items. I think we just wanted to avoid the complexity of trying to calculate if the arrows should need to be present or not. With responsive design being all the rage these days, I'm not sure making such assumptions is safe or a good idea.
Comment #7
quicksketchWell I thought we had added this, but upon further research it doesn't appear that this is the case. I'm not sure if we should add this sort of functionality to the jCarousel module, it seems like something the jCarousel library itself should do automatically.
Comment #8
knalstaaf commentedYes, maybe so.
Comment #9
quicksketchI've implemented this functionality with the attached patch. To make life easier I've also "undone" the hardcoded "display: block" that jCarousel puts on the navigation buttons. This simplifies our CSS quite a bit both for our jcarousel-default.css and for anyone wanting to make their own CSS. The changes should be compatible with existing CSS.
Committed to both 2.x branches.
Comment #10
knalstaaf commentedBrilliant, thanks!
Comment #12
slayne40 commentedHy,
Little trouble when the carousel is in automatic scrolling.
The buttons are not displayed, but the image keeps scrolling.
I changed this part of the patch :
By :
Thanks.