I've been playing around with the right-sided alphabet idea and finally made
some headway this weekend. I don't have a link to share for you to check
out, I'm developing locally on my laptop with Rails. I have a three div
setup; Fixed header, fixed-height scrollableArea, Fixed footer. In between
the header and scrollable div is the alphabet div with fixed position,
hovering over the right-edge of the two-finger scrollable div. It's not an
animated scrollTo, but it jumps to whatever letter I click on in the list:
So, my two-finger scrollable container is called list_pane and each letter
header row in the list gets its own id of letterA, letterB etc..
For every letter link in the side alphabet,
onmousedown="divscrollTo(list_pane, letterS)" or whatever letter it happens
to be...
function divscrollTo(container, element)
{
container = $(container);
element = $(element);
var y = element.y ? element.y : element.offsetTop;
container.scrollTop=y-(document.all?0:container.offsetTop);
return element
}
This is an edited version of something I found posted on the
mail-archive.com site. It's hard to tell who posted certain posts the way
the heirachy is laid out, but it looks like the original code I tweaked was
by Brian Peiris. Just want to make sure he gets most of the credit.
If you want to be able to scroll/jump in the x as well, add in the following
x parts...(or swap the y parts for x parts to only jump left/right:)
function divscrollTo(container, element)
{
container = $(container);
element = $(element);
var x = element.x ? Element.x : element.offsetLeft;
var y = element.y ? element.y : element.offsetTop;
container.scrollLeft=x-(document.all?0:container.offsetLeft);
container.scrollTop=y-(document.all?0:container.offsetTop);
return element
}
-=Randy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" 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/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---