View Full Version : Step Carousel center panel problem

12-11-2012, 11:33 PM
1) Script Title: Step Carousel Viewer v1.9

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm

3) Describe problem: My example page: http://www.lastyling.co.uk/test/gallery.html I've set up the carousel and it works great however I'd like to center the active panel instead of it going to the left of the belt.

I've found this bit of the code in the JS file:

$currentpanel.css({float: 'none', position: 'absolute', left: paneloffset+'px'}) //position panel

which if I change paneloffset to 150px for example I can influence the panel to be centered. The problem is however that the panels I'm using are all different widths so not all the panels are being centered with a fixed measurement. The carousel width is 1010px so I think I need the code to take width of the 'active' panel and subtract that from 1010px and then divide that by 2 in order to center the content however I'm a bit of an amateur with the javascript/jquery side of things so I'm having no luck whatsoever!

Is there a way to something similar to this or will be forced to use the semi-solution I've got and use images with the same widths?

Any help you can give will be hugely appreciated!


12-12-2012, 12:42 AM
Can you not do that on each panel individually where differing widths are defined? See method 2: http://www.dynamicdrive.com/dynamicindex4/stepcarousel_suppliment.htm

I imaging that "left:?px" or "margin-left:?px" would do it but I havent test as I'm on iPhone.

12-12-2012, 05:06 PM

12-12-2012, 08:16 PM
Beverleyh - Thanks for the reply but because it was being reset each time by the javascript it wasn't working quite as I wanted.

vwphillips - HUGE thanks! That is exactly what I wanted! Just had a couple of questions:

1) Is it possible to have the first and last panels not centered but instead left aligned for the start and right aligned for the end? Not a big problem if this can't be done as instead I will make those panels the full width off the carousel.

2) Is there a way to target the active, previous and next slides? I'd look to darken the panels on either side if possible to draw focus to the active slide.

Again massive thanks for taking the time out to help!


12-13-2012, 01:54 PM

I will look at the darken slide later

12-14-2012, 11:48 AM

12-16-2012, 11:28 PM
I really can't thank you enough for your help, that is absolutely perfect!