I'm trying to synchronize the scrolling of two <div> elements. The
top element is for showing column headers, the bottom div shows the
table rows.
I consed up the following HTML/JavaScript concoction which does
something useful in IE and also in Mozilla 1.4.
However, the problem is that it only works in Mozilla if I say
overflow:auto in the top frame, it ceases working if I say
overflow:hidden . But saying overflow:hidden is desirable because it
eliminates a superfluous scrollbar. overflow:hidden works in IE.
Any suggestions on getting rid of the scrollbars in Mozilla, too?
tia,
Kai
<html>
<head>
<title>Testin g div scrolling</title>
<script language="JavaS cript">
<!-- // Begins
var topdiv;
var bottomdiv;
IE = (document.all) ? true : false;
last_x = 0;
last_y = 0;
function synchronizeScro ll() {
if (bottomdiv.scro llLeft) {
topdiv.scrollLe ft = bottomdiv.scrol lLeft;
}
}
// Ends -->
</script>
</head>
<body onScroll="synch ronizeScroll()"
onLoad="if (!IE) window.setInter val('synchroniz eScroll()',
100);">
<div id="topdiv" style="width:20 0px;overflow:au to">
<pre>123456789| 123456789|12345 6789|123456789| 123456789|12345 6789|123456789| </pre></div>
<hr>
<div onScroll="synch ronizeScroll()"
id="bottomdiv" style="width:20 0px;height:100p x;overflow:scro ll">
<pre>
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
abcdefghijklmno pqrstuvwxyzabcd efghijklmnopqrs tuvwxyzabcdefgh ijklmnopqrstuvw xyz
</pre>
</div>
<script language="JavaS cript">
topdiv = document.getEle mentById('topdi v');
bottomdiv = document.getEle mentById('botto mdiv');
</script>
</body>
</html> 5 14583 Ka************* @gmx.net (Kai Grossjohann) wrote in message news:<e8******* *************** ****@posting.go ogle.com>... However, the problem is that it only works in Mozilla if I say overflow:auto in the top frame, it ceases working if I say overflow:hidden . But saying overflow:hidden is desirable because it eliminates a superfluous scrollbar. overflow:hidden works in IE.
Any suggestions on getting rid of the scrollbars in Mozilla, too?
It turns out that overflow:-moz-scrollbars-none works in Mozilla: the
scrollbars are hidden, yet I can scroll programmaticall y.
So now I have this horrible piece of JavaScript which frobs the DOM to
change the overflow attribute if running in Mozilla. Suggestions for
improvements are most appreciated.
if (topdiv.style.M ozAppearance == "") {
// We seem to be running in Mozilla, so let's frob the overflow
attribute.
topdiv.style.ov erflow = '-moz-scrollbars-none';
}
I'm not sure about the test that finds out if we are running Mozilla.
Cheers,
Kai
Kai Grossjohann wrote: It turns out that overflow:-moz-scrollbars-none works in Mozilla: the scrollbars are hidden, yet I can scroll programmaticall y.
So now I have this horrible piece of JavaScript which frobs the DOM to change the overflow attribute if running in Mozilla. Suggestions for improvements are most appreciated.
if (topdiv.style.M ozAppearance == "") { // We seem to be running in Mozilla, so let's frob the overflow attribute. topdiv.style.ov erflow = '-moz-scrollbars-none'; }
I'm not sure about the test that finds out if we are running Mozilla.
You are testing the wrong thing. Test if the property is available, then
you can hope for the rest of the `style' property to work as supposed:
if (typeof topdiv.style != "undefined"
&& typeof topdiv.style.Mo zAppearance != "undefined" )
{
...
}
The same goes for your `IE' boolean variable. See http://pointedears.de.vu/scripts/test/whatami for details.
And please use http://validator.w3.org/, your HTML is far from valid.
Have you ever thought of users without client-side JavaScript support?
PointedEars
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes: Have you ever thought of users without client-side JavaScript support?
I try not to think of them poor buggers. Makes me feel sad.
Some day, the result will enter the annals of history as the web app
that violates all web and accessibility guidelines in existence.
Please excuse me while I find a rock to hide under,
Kai
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes: You are testing the wrong thing. Test if the property is available, then you can hope for the rest of the `style' property to work as supposed:
if (typeof topdiv.style != "undefined" && typeof topdiv.style.Mo zAppearance != "undefined" ) { ... }
Ah, right. I see that I was thinking in the right direction. I will
learn. I've only been doing this JavaScript stuff for two weeks,
before that time I didn't even know how to spell JavaScript...
Thanks for teaching me.
The same goes for your `IE' boolean variable. See http://pointedears.de.vu/scripts/test/whatami for details.
Thanks. I copied the IE variable from a tutorial or sample snippet
somewhere. It was good enough for a quick exploration, but I'll
replace it, as I learn more.
And please use http://validator.w3.org/, your HTML is far from valid.
OK. I guess there is also a command-line version, I've been wanting
to have this for quite a while now. Maybe even somebody has something
for Eclipse...
Kai This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hugh Dickinson |
last post by:
Does anybody know whether the netscape 7+ browsers support afunction similar
to the internet explorer doScroll() function, this has the effect of
pressing the scrollbar button, but can be scripted allowing me to lose those
horrible scrollbars.
Regards
Hugh Dickinson
h.j.dickinson@dur.ac.uk
|
by: nina |
last post by:
Hi all,
I've been working on a site that involves content in multiple
scrolling DIVs on a page which is loaded inside multiple framesets.
the layout is cramped as all hell but I'm not going to argue that with
the client -- they def. want it to be structured this way.
One DIV usually contains two "comparable" items between which the user
can switch. I solved this by putting inline links at the top of the
DIVs that link to an <A...
|
by: Frances Del Rio |
last post by:
why do I keep getting scroll bars on frames even though I have scrolling
set to "no"?? (am on IE..) I mean even if you put an img in there or
sthg that's a bit larger than the frame if you set scrolling to NO
shouldn't it sitll appear w/no scroll bars?? thank you..
Frances Del Rio
|
by: Gianni Rondinini |
last post by:
i'm talking about this page:
http://www.elleen.net/yanny/prova.html
colours are awful, but they're there just to realize where divs begin
and end.
in firefox it works pretty good --well, at least it's almost what i'm
expecting it to be--, but it's not perfect yet.
with internet explorer it's completely messed up --and i don't
understand why--, but i'm not going to talk about this at this moment.
as you can see if you have a look at the...
|
by: al jones |
last post by:
I guess one question at a time will work better.
URL http://aljones.us (yes, I'm back again)
I'd like to cause this whole page to fill the viewable window if I can.
Meaning that I'd like the entire page to be visible on the current users
screen.
That means that I'd like one or both of the divs to scroll. I've found how
to do that, I think, but can't seem to 'size' the page so it fits on
| |
by: nan |
last post by:
Please give me some tips or some source code by using which able to
make the avi file for audio and video data to play in sync.
Some details are given below:
I noticed that many times the video recorded is 7 Frames
per second and again it will change to 15 frames per second. While in
this scenario the audio card's sampling frequency is 8000Hz therefore
the number of samples per second is 8000. So , in this situation I am
not...
|
by: knoxautoguy |
last post by:
This problem has consumed a lot of my time, and I'm aftraid someone
will tell me that my whole approach to this objective is wrong;
however, I would like to know if there is a way to do this.
I have a web page divided into two major segments, with the top segment
fixed and the bottom segment allowed to scroll, thus giving the look of
frames without frames.
I also have anchors so that users can click on a letter of the alphabet
to jump...
|
by: Gary |
last post by:
If one has two iframes side by side is it possible to get them both to
scroll when the user scrolls one of them? If it is possible is there a
reference that will help me in solving this.
Someone suggested I try this group.
Gary
|
by: stan |
last post by:
I have internal links/jumps within divs. The divs have vertical
scrolling. When a link is clicked, both the space within the div as
well as the entire page vertically scroll. I would like to restrict
the vertical scrolling in this situation (when an internal link is
clicked) to the space within the div (the entire page should not
scroll). Is this possible?
|
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...
|
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...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |