By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,045 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,045 IT Pros & Developers. It's quick & easy.

Visible scrollbars

P: n/a
GTi
I have a popup window, If this window is to smaal the scrollbars is
visible.
Is there any JavaScript available so I can check if the scrollbars is
visible on page (right and bottom side)?
Then I can auto resize the window so it dosen't show (until a maximums
size).

Jan 2 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a

GTi napisal(a):
I have a popup window, If this window is to smaal the scrollbars is
visible.
Is there any JavaScript available so I can check if the scrollbars is
visible on page (right and bottom side)?
Then I can auto resize the window so it dosen't show (until a maximums
size).


Certainly others will provide some answer that does exactly what you
want (possibly based on scrollHeight, scrollTop etc) but for now my
answer was BODY {overflow: hidden;} in stylesheets.

Jan 2 '06 #2

P: n/a
bw****@gmail.com wrote:
GTi napisal(a):
I have a popup window, If this window is to smaal the scrollbars is
visible.
Is there any JavaScript available so I can check if the scrollbars is
visible on page (right and bottom side)?
Then I can auto resize the window so it dosen't show (until a maximums
size).

Don't even attempt it. Users can maximise their windows with a single
keystroke or mouse click. If their windows are set to a certain size,
it's because they want them that way.

Certainly others will provide some answer that does exactly what you
want
Nah, most don't care for pop-ups at all. Scripts that try to resize
them are just a further annoyance and may well be prevented by user
preference settings anyway.

(possibly based on scrollHeight, scrollTop etc) but for now my
answer was BODY {overflow: hidden;} in stylesheets.


So users can't access the overflow - guess that serves them right for
having a smaller than expected window or monitor.
--
Rob
Jan 2 '06 #3

P: n/a
GTi wrote:
I have a popup window, If this window is to smaal the scrollbars is
visible.
Is there any JavaScript available so I can check if the scrollbars is
visible on page (right and bottom side)?
Then I can auto resize the window so it dosen't show (until a maximums
size).


You have not thought this through. Consider, for example that users have
a text zoom level that makes it impossible to display the window without
scrollbars on the current screen -- iff there is a (popup) window, and iff
there are scrollbars, provided by a graphical user interface.
PointedEars
Jan 2 '06 #4

P: n/a
GTi
RobG wrote:
bw****@gmail.com wrote:
GTi napisal(a):
I have a popup window, If this window is to smaal the scrollbars is
visible.
Is there any JavaScript available so I can check if the scrollbars is
visible on page (right and bottom side)?
Then I can auto resize the window so it dosen't show (until a maximums
size).

Don't even attempt it. Users can maximise their windows with a single
keystroke or mouse click. If their windows are set to a certain size,
it's because they want them that way.

My Web Application use popup to fill in some information. Based on the
type of information the window size can vary (don't mention the content
of a combo box).
So instead of hardcode the size I want to leave it to JavaScript to
find the best size whitin maximum bounderies. This is only on popup and
when the page load.

Certainly others will provide some answer that does exactly what you
want
Nah, most don't care for pop-ups at all. Scripts that try to resize
them are just a further annoyance and may well be prevented by user
preference settings anyway.

I mostly agree - but only for public internet sites. For web
applications (mostly intranet) popup is is good thing for filling in
information or see properties for some items.

(possibly based on scrollHeight, scrollTop etc) but for now my
answer was BODY {overflow: hidden;} in stylesheets.
No - This is no option at all.

So users can't access the overflow - guess that serves them right for
having a smaller than expected window or monitor.
--
Rob


I gues you don't know of a script like this then...

Jan 2 '06 #5

P: n/a
GTi
Thomas 'PointedEars' Lahn wrote:
GTi wrote:
I have a popup window, If this window is to smaal the scrollbars is
visible.
Is there any JavaScript available so I can check if the scrollbars is
visible on page (right and bottom side)?
Then I can auto resize the window so it dosen't show (until a maximums
size).


You have not thought this through. Consider, for example that users have
a text zoom level that makes it impossible to display the window without
scrollbars on the current screen -- iff there is a (popup) window, and iff
there are scrollbars, provided by a graphical user interface.
PointedEars


To fill in some more information:
This is only for POPUP windows AND for WEB APPLICATIONS.
And the JavaScript is only used to find the best size of the POPUP
window WHITIN maximum bounderies AT startup only. And if the user WANT
to resize the window after the page is loaded the script will NOT
interfer.

Jan 2 '06 #6

P: n/a
GTi wrote:
Thomas 'PointedEars' Lahn wrote:
GTi wrote:
> I have a popup window, If this window is to smaal the scrollbars is
> visible.
> Is there any JavaScript available so I can check if the scrollbars is
> visible on page (right and bottom side)?
> Then I can auto resize the window so it dosen't show (until a maximums
> size).
You have not thought this through. Consider, for example that users have
a text zoom level that makes it impossible to display the window without
scrollbars on the current screen -- iff there is a (popup) window, and
iff there are scrollbars, provided by a graphical user interface.
[...]


To fill in some more information:


Where there was no need to SHOUT it.
This is only for POPUP windows AND for WEB APPLICATIONS.
And the JavaScript is only used to find the best size of the POPUP
window WHITIN maximum bounderies AT startup only. [...]

^^^^^^^^^^
What is your definition of "at startup"? If it means you want the window
opened with best size for all conceivable content, that is not possible;
unless you implement a layout engine in JS/ECMAScript, of course -- good
luck ;-)
PointedEars
Jan 2 '06 #7

P: n/a
VK

GTi wrote:
To fill in some more information:
This is only for POPUP windows AND for WEB APPLICATIONS.
And the JavaScript is only used to find the best size of the POPUP
window WHITIN maximum bounderies AT startup only. And if the user WANT
to resize the window after the page is loaded the script will NOT
interfer.


There are ways to allow/disallow scrollbars, but I do not recall any
method to query like isScrollbarDisplayed (same as with status bar).

But IMHO you're going from the opposite to the right direction:
scrollbars are not a natural phenomenon but a *consequence* of a
content which is too big for the provided viewport. So instead of study
the consequences you can jump right on the reason:
prepare the layout and find it offsetWidth / offsetHeight; then open
the window of the matching size. If the needed size is beyond the range
you still know in advance that scrollbars will appear - and you know
from what side(s).

Jan 2 '06 #8

P: n/a
VK said the following on 1/2/2006 10:54 AM:
GTi wrote:
To fill in some more information:
This is only for POPUP windows AND for WEB APPLICATIONS.
And the JavaScript is only used to find the best size of the POPUP
window WHITIN maximum bounderies AT startup only. And if the user WANT
to resize the window after the page is loaded the script will NOT
interfer.

There are ways to allow/disallow scrollbars, but I do not recall any
method to query like isScrollbarDisplayed (same as with status bar).

But IMHO you're going from the opposite to the right direction:
scrollbars are not a natural phenomenon but a *consequence* of a
content which is too big for the provided viewport. So instead of study
the consequences you can jump right on the reason:


And it is answered here:
<URL: http://allmyfaqs.net/faq.pl?AnySizeDesign >

Now, the size of my text (which you can't account for), my added
toolbars, and anything else is irrelevant and you don't need scripting
to figure it out.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 2 '06 #9

P: n/a
Randy Webb a écrit :
VK said the following on 1/2/2006 10:54 AM:
GTi wrote:
To fill in some more information:
This is only for POPUP windows AND for WEB APPLICATIONS.
And the JavaScript is only used to find the best size of the POPUP
window WHITIN maximum bounderies AT startup only. And if the user WANT
to resize the window after the page is loaded the script will NOT
interfer.


There are ways to allow/disallow scrollbars, but I do not recall any
method to query like isScrollbarDisplayed (same as with status bar).

But IMHO you're going from the opposite to the right direction:
scrollbars are not a natural phenomenon but a *consequence* of a
content which is too big for the provided viewport. So instead of study
the consequences you can jump right on the reason:

And it is answered here:
<URL: http://allmyfaqs.net/faq.pl?AnySizeDesign >

Now, the size of my text (which you can't account for), my added
toolbars, and anything else is irrelevant and you don't need scripting
to figure it out.


Allow me to help you make your list more complete:

http://developer.mozilla.org/en/docs..._on_scrollbars

Gérard
--
remove blah to email me
Jan 3 '06 #10

P: n/a
GTi
When making "ordinary" web pages all this web page guidlines is ok for
me - and I do follow them.
But web pages is more "powerfull" today. We make them more interactiv
and even make them more like a windows desktop applications. And that
is what I want to do.
I used to make desktop applications before. If anyone of you have made
a desktop applications you know that a popup window is needed to fill
in/edit infomation (ex to a database). But the size of the popup
window must fit its content, else it will look like crap.
You can size a web popup window but it is done every time you create a
pop up window.
I always create standard classes and reuse them. And the (auto) size of
a popup window shuld be a function in in the standard class (in my
mind). But as we all now know(!) that can't be done - it must be a
parameter to the class.

But a autosize popup window will still be perfect:
When a user use a larger font:
With autosize: The popup window will resize to fit the content (but the
user can still resize it if he need to).
Without autosize: The popup window will be too small so user MUST
resize the window.

Jan 3 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.