views:

38

answers:

1

I have a "bar" across the top of my page, 100px hight and 100% page size.

I have an unordered list of images displayed inline in there 80x80 (10px padding all round) and I have tried several methods of displaying "more" images than fit on the screen either by wrapping to several lines or by scroll.

What I would prefer would be something simple and elegent on each side I could click to have it scroll across one more image each click, or hover over the "button" to have it continuously scroll.

UPDATE: I got it working with JCarousel but then decided I'd prefer to write it entirely myself.

I current have a working system whereby I can click on a button either side of the screen to have it scroll left or right a certain amount. My only problem is that if I keep clicking once it's ran out of items to scroll it still increments the number. I need to make sure it stops when it's done, otherwise i have to click the same number of times in the opposite direction before it starts moving again.

I tried doing it by counting the number of elements in my unordered list but that didn't work because there isn't always the same number of items on the screen at different resolutions and window sizes So I cn't allow a certain number of clicks in each direction.

My next option is to dynamically find the screen width and use that to scroll, any ideas?

+1  A: 

If I understand you correctly, this plugin might help. (The demo image takes a moment to load.)

It allows you to scroll an overflowed area without scroll bars. I've used it in combination with click events on the listed items, and it works fine.

harpo
Ok, I'v implemented it, and it works, but rather than holding to drag, I need an arrow each side to do the scrolling. It's a little more intuitive to a user. ANy suggestions of a JQuery call i can make on a button i place each side to make it scroll so many pixels each click?
Hamid
@Hamid, I agree it's not obvious. The arrow buttons are a good idea, which I might try myself. I know you can animate the scrollLeft of the parent (the thing you called overscroll on) to move it programmatically.
harpo
I would like to point out that the solution for my particular problem was not in the body of the answer but in the comment above me. I managed to write a script that uses the scrollLeft and some calculation according to the current window size and number of images currently visible to enable scrolling of the gallery correctly.
Hamid