Another simple Javascript question :-)

74 views
Skip to first unread message

Eyal

unread,
Oct 29, 2012, 12:59:45 PM10/29/12
to webmaste...@googlegroups.com
Hi friends,

I've implemented Flexcroll javascript custom scroll-bars on some horizontal scrolling in a website. It all works well, but I want to be able to add a "reset" button at the end that jumps to the beginning.
It seems to be supported; I found the following information:


"You may set a scroll position using yourDivElement.fleXcroll.setScrollPos(horizontal_scroll_position, vertical_scroll_position)
yourDivElement.fleXcroll.setScrollPos(false,200);
This sets the vertical scroll positon, 200 pixels down. The function also returns the scroll positions in the same format as yourDivElement.fleXdata.scrollPosition."


However, I cannot find information about how to actually use this. What is "yourDivElement"? Is it a place holder, where I should put the id of my div? And then, how to call it? I tried different ways (making a link with this script) but nothing works (FF-debugger keeps saying it's not a function).

Any help will be very welcome.
Thanks a lot
Eyal



Vision Jinx

unread,
Oct 29, 2012, 9:10:18 PM10/29/12
to webmaste...@googlegroups.com
Sounds like it's asking for a reference to the element that your using for the scrollable content. "yourDivElement"

Code sample:

<div id="foo">This is my Flexscroll scrolling content!</div>

Try

document.getElementById('foo').
fleXcroll.setScrollPos(0,false);

(you may have to try 1 instead of 0 if 0 doesn't work... eg. 0px may not be a valid value)

See if that works. Also, IIRC flexscroll has a sample where it would jump forward and back by something like 20px at a time, maybe view source or look at their code sample as a reference as well.

Regards,
Vision Jinx

Eyal

unread,
Oct 31, 2012, 4:13:05 PM10/31/12
to webmaste...@googlegroups.com
Thank you, VJ, very much for your answer. I tried what you suggested, including trying to understand the samples, but I still can't get it to work. I have never seen such bad documentation for a commercial product. In any case I'm going to leave it now and try further when I have more time.
Thanks again
Eyal

Eyal

unread,
Nov 2, 2012, 4:45:02 AM11/2/12
to webmaste...@googlegroups.com
OK, I got it to work, indeed by reverse-engineering the samples. Pity such a basic function had to be hidden like that in an otherwise splendid product.
(Thanks Vision Jinx)
Eyal
Reply all
Reply to author
Forward
0 new messages