473,663 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11843
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.preventDefaul t )
e.preventDefaul t();
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
2186
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 width of my layout if a page in the application uses a scrollbar, some of the pages show lists of search results so I do now know the pages the expand the iframe height up front. How can I detect if the scrollbars are showing inside me page?
7
26037
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
4399
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 thing: there is no vertical scrollbar even there are more lines than can be shown on the datagrid. There is plenty room on the right for the scrollbar but it is not there. If there is a scrollbar property for the .Net datagrid like in the VB6 DBgrid,...
9
4316
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
10649
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 {scrollbar-3dlight-color:aqua; scrollbar-arrow-color:fuchsia; scrollbar-base-color:fuchsia;
5
2268
by: Shailja | last post by:
Hi, How to lock the grid without locking scrollbar? If you know the answer, kindly let me know
3
3198
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 add simple styling to the scrollbar of the left hand frame of the page, but the styling i've applied isn't working for some reason. The site is at http://www.maguiresonline.co.uk/new_website/index.html It's the scrollbar in the middle of the...
1
2212
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 programmer/program that helps me in this situation. i got add rows from this site: * http://www24.brinkster.com/scriptbreaker/home.htm i got lock columns from this site:
1
13726
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 inconsistent in the detection of a vertical scrollbar. This involves situations when less than the client area is needed to hold the small amount of data. The inconsistency is when adjusting the panel size within or just below the bottom row....
0
8436
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.