Sure, although I'm not sure if there's a fancy shortcut for it yet.

Once you have your selected item, I'm assuming you have the means to figure out its dimensions and position within the DIV (using Element.getDimensions () and a Position function from prototype). So you can then change the .scrollTop property of the DIV so it's below the bottom of the image element. And of course you can set up a timer to animate the movement if you want, or create a custom Effect object so that is a re-usable thing.

Sorry if this was too high-level and you're were actually looking for the implementation details. I don't have them time atm to try to mock something up for you. But if you were more just looking for the general "yes it's possible and here's a possible way to get it done"... this should do.

I'm sure others will be able to help with the details if you get stuck further (very sorry on that point, so little time).


On 10/12/06, Alex Duffield <[EMAIL PROTECTED]> wrote:
I have a div that holds image thumbnails. I have set it up so I can use the arrow keys on the keyboard to select or move between the images. 

The div can hold quite a few image thumbnails, so is set to overflow:auto so wil have scroll bars when there are to many images. 

What I want is for the selected image to always be in the viewable area, so when I use the down arrow for example to move between images and go below the viewable area I want the contents to scroll up so the selected image is visible (For you mac users, this is the way iPhoto works.) 

I looked at Element.scrollTo($(id)) but that seems to only scroll the page. 

Is there any way I can scroll the contents of my DIV. 

Thanks!

______________________________________________________________________

Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com  







--
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-954-9798 x2903
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to