0

I've got 10 floating DIVs in a container DIV that I want to be able to scroll through using a button.

I'd like to use left/right buttons to make the container DIV scroll 300px horizontally to display the next floating DIV.

I'd like the width of the container to appear as 100% of the window, and I'd also like there to be no horizontal scroll-bar on the bottom. If it could scroll sideways that'd be great but it's not a must have.

Here's what I've got: http://jsfiddle.net/696je/

I'm just looking for a function and the way to activate the function for left/right buttons.

I've tried Google for hours, I've tried Flesler's ScrollTo but I haven't had any luck, it might be something do to with the way I've got the width set up, anyway, thanks for your help.

ahren
  • 16,803
  • 5
  • 50
  • 70
toams7
  • 51
  • 1
  • 8
  • I understand that you've said you've tried to google for hours, and you've tried a ScrollTo plugin... but you haven't shown us WHAT you have tried, so therefore it could be suggested that you haven't tried anything... I suggest posting the code you have tried, and then we can try and fix it for you, hopefully helping you to understand it a bit better in the process. – ahren Sep 26 '12 at 03:40
  • tldr: Please post the code you HAVE tried. – ahren Sep 26 '12 at 03:48

2 Answers2

0

I was a little confused by your code you posted in the jsFiddle. You said you wanted no horizontal scroll bars, yet your stuff was set up that way. I went with the horizontal scroll bar since that is what you were going with in your code.

I made a working function here jsFiddle. To get it to work in the frame you need to put focus in the "Result" window (just click anywhere), then use your left and right arrows.

I must give the javascript for keypress credit from this post

Community
  • 1
  • 1
ZombieCode
  • 1,646
  • 2
  • 24
  • 46
0

It is possible to do with mix of CSS (display:inline-block and white-space:nowrap) and jQuery (scrollLeft)

here is a jsFiddle implementation with minimum possible wrappers.

Anil Kumar
  • 165
  • 6