473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Is there any way to lock scrollbar?

Hi:
I have a javascript that creates a custom scrollbar for a div in the
middle of my page.
The problem is that when I scroll in my div it scrolls the div and the
scroll of the page so I loose the position i want and exists from my
div.

So , what I want is to lock the window scrollbar in the moment I am
over my div, so I can scroll my div without any window movement.

Is this possible?

Aug 4 '06 #1
3 11835
jkarpago wrote:
Hi:
I have a javascript that creates a custom scrollbar for a div in the
middle of my page.
The problem is that when I scroll in my div it scrolls the div and the
scroll of the page so I loose the position i want and exists from my
div.

So , what I want is to lock the window scrollbar in the moment I am
over my div, so I can scroll my div without any window movement.

Is this possible?
I think the problem you're having is that you scroll the div using the
mouse wheel, and it makes the window scroll. Correct?

If so, you need to prevent the default action for the scrolling event
(which is to scroll the window).

function scrollDiv( e )
{
.... // your code
if( !e ) e = window.event;

if( e.preventDefault )
e.preventDefault();
else
e.returnValue = false;
}

Aug 4 '06 #2
Thank you so much, that is exactly what I needed

Aug 9 '06 #3
I think you can solve problem much more easy with css, not javascript.
you can set the height of your div, and the system will creat the
scroll auto when the div need it. and that wouldn't make any proplem
you have met .
as i knew, ie ,firefox, mozilla, netscape and opera can do it perfect,
and no compatible problem in these browsers recent version, but i'm
not sure this set will also usefull on ie3 or some other browsers old
version.
however, if you wanner some special effict on the scroll, you should
take other's advice
>>FROM:Gucci Koo(China)
Aug. 11th, 2006
Aug 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kristian | last post by:
I'm including an application into a customer website using an iframe. Some of the pages have a scrollbar since their height expands the height of the iframe. My problem is, I need to resize the...
7
by: Sujan | last post by:
Hello all, Is it possible to remove scrollbar(s) without using frames. Is there any code which could be applied in body tag to remove scrollbar(s). Thanks in adv, Sujan
4
by: Price Brattin | last post by:
I dragged a datagrid onto a VB.Net WinForm and used the properties page and a few lines of code to set it up, including the DataSource. No wizard setup was used. It works fine except for one...
9
by: kjs | last post by:
Is there any was to control the color of the scrollbars when using the 'overflow: scroll' attribute? TIA, Karl
2
by: kurt sune | last post by:
How do I render the scrollbars by CSS in a listbox? I have understood that an asp listbox gets rendered as a select element. So I tried first by adding a style element: ..TA...
5
by: Shailja | last post by:
Hi, How to lock the grid without locking scrollbar? If you know the answer, kindly let me know
3
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to...
1
by: graphicguru | last post by:
Hi i got some javascript from (*) these site for lock one column with js and header row with css. i am not a programmer i am a designer. i am working in a small company. i don't find such...
1
by: Tom | last post by:
First, I posted a similar request for help in another group and now don't find the posting. Problem with my newsreader perhaps ... but apologies if this appears as a cross posting. My code is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.