PDA

View Full Version : Scrollbar parameters. (javascript scrollbar)


Single Paradox
04-16-2006, 07:40 PM
I have been redoing my scrollbar script too many times to count, but here is my latest: http://singleparadox.com/temp/scrolltest.htm

I know how to make the parameters so the scrollbar can not go past a certain spot, such as a real scrollbar, but I wanted some help first.

This: http://singleparadox.com/codes/ScrollBar , is my attempt to create a ending and a starting point for the div, but as you can see, if you try moving the bar really fast, the bar does not go all the way down or all the way up. It somehow catches on something when it stops. Why is this?

I'm sorry, but if you need more information just let me know, because I had a hard time describing my problem.

Thanks

Edit: and I noticed that vic's javascript does the same thing. Lemme try and pull up the link

konithomimo
04-16-2006, 07:58 PM
Try this:

DHTML Scroll Bars (http://www.dyn-web.com/dhtml/scroll/)

Single Paradox
04-16-2006, 08:42 PM
Thank you for that link, but I am stubborn and I want to make it myself. ;)

I'll use that for a referrence but I do not know how they do it. I am in the middle of math homework right now so I will not look at the code, but I'll check later.

vwphillips
04-17-2006, 12:11 AM
Single Paradox

Thanks for the feed back

I have a number of scroll bars

Just tried this in FF and IE
http://www.vicsjavascripts.org.uk/ScrollBars/ScrollBars.htm

and it does not go off the ends, but can loose focus on image sliders, which I will fix

Single Paradox
04-17-2006, 06:02 AM
Yeah, I noticed the lost focus, why is that? And every time I try it looses focus, so I thought that was what you wanted.

Single Paradox
04-18-2006, 02:40 AM
There is still a better way to do it than you are doing. I just don't know how. :p

I've been trying to work out how n-son did it on his script:

http://n-son.com/scripts/jsScrolling/example6.html

vwphillips
04-18-2006, 07:27 PM
Not sure what aspect you are refering to but

if its a matter of the slider limits
the tavel is simple to limit as there are no up an down buttons to take into account.

If it is the loss of focus.
Its not using images

If it is the slider marker position
the position is relative to the slider height/yscroll position ratio from the top of the slide

If it is the scroll to
that is explained on the page

Nice effect though

Single Paradox
04-18-2006, 10:44 PM
I am just trying to create a scrollbar. heh. I just don't want to steal one from someone else because I am stubborn. Basically I just want to know what the best approach is. Vw, did you use:

if(scrollbar.style.top<=400&&scrollbar.style.top>=0){


or something like that? I have trouble reading your codes with all the zxc's lol.

Or did you use a variable to count up to a number?

vwphillips
04-19-2006, 08:01 AM
as the slider top and travel are static I make these properties of the slider
and only change if the bar height changes

travel = bar height - upbuttonheight - downbuttonheight - sliderheight
top = upbuttonheight

the comparison of the slider position aginst these values are the slider limits

so only drag if position is geater than top or less than
and if > travel, position at travel
if < top, position at top

you can change/remove the zxc's with characters of choice using global fond and replace