TotalrecordCount = 300
Page size = 10
Pagecount = TotalrecordCount / Pagesize /* 30*/
One row size = 20px
Body size = 20px * pagesize
ScrollTrackSize = Body size /*200*/
ScrollPointerSize = Body size /Page count /*15*/
One row track size = 15 / 10; /*ScrollPointerSize / Page size = 1.5*/


My Problem is that if one row track size is floating number than i can't move the element with this value. Is there any logic to create this custom bar or Can i set position of element
to this float value . Please help me.


I use this logic to create custom scroll bar and retrieves records from server side as user scrolls.

If the One row track size is an integer number than there is no problem bcz i can move the ScrollPointer to this value.

Can any conversion can be done between px and pt or %?
Is there any other simple logic to create custom scroll bar?

I am begineer in javascript and css.
So please help me to find out this.

Member Avatar for langsor

First I have to ask ... why create a custom scrollbar with javascript (Flash I can understand) when there are perfectly good ones built into the browsers?

Why not use a <div style="overflow:auto"></div> or something like that?

But to attempt to answer your question ... using CSS positioning with JavaScript works with floating point numbers (last time I did it).

document.getElementById('img').style.top = (15 / 10) + 'px';
document.getElementById('img').style.height = (15 / 10) + 'px';

Does this help?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.