Solved

Detect Scrollbar

Posted on 2004-04-26
50
19,649 Views
Last Modified: 2011-08-18
How do I detect  scroll down  or  scroll right  exist on an IE browser page with javascript?
And how do I detect  the current page has no scroll down  or  scroll right?
0
Comment
Question by:wieb18
  • 14
  • 13
  • 13
  • +3
50 Comments
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
0
 

Author Comment

by:wieb18
Comment Utility
I had read the scrollbar detection article on http://codepunk.hardwar.org.uk/ajs02.htm which said:

" Internet Explorer stores the value of the vertical scrollbar in a property called "document.body.scrollTop". This represents the number of pixels the viewer has scrolled down from the top of the page.
Internet Explorer stores the value of the horizontal scrollbar in "document.body.scrollLeft". This represents the number of pixels from the left of the page that the viewer has scrolled. If one or the other scrollbars doesn't exist for a particular page, the returned value is 0 (the number zero).
Netscape stores the vertical scrollbar data in a property referred to as "window.pageYOffset". This is the same pixel value as in IE's "scrollTop", just a different JavaScript reference. Netscape uses "window.pageXOffset" to find the position of the horizontal scrollbar. Pay particular attention to the capitalization of the Netscape offsets. Netscape, too, returns a 0 for a scrollbar that does not exist on a particular page."


In my opinion, it is totally wrong explanation because regardless scrollbar exist or not, the value in "document.body.scrollTop" and in "document.body.scrollLeft" will remain 0 as long as we don't do scroll right or scroll down. The value will be change from 0 to pixel scroll position value if we do scroll right or scroll down.

Now, how do I detect  vertical scrollbar or horizontal scrollbar exist on IE???
0
 

Author Comment

by:wieb18
Comment Utility
I had read the scrollbar detection article on http://codepunk.hardwar.org.uk/ajs02.htm which said:

" Internet Explorer stores the value of the vertical scrollbar in a property called "document.body.scrollTop". This represents the number of pixels the viewer has scrolled down from the top of the page.
Internet Explorer stores the value of the horizontal scrollbar in "document.body.scrollLeft". This represents the number of pixels from the left of the page that the viewer has scrolled. If one or the other scrollbars doesn't exist for a particular page, the returned value is 0 (the number zero).
Netscape stores the vertical scrollbar data in a property referred to as "window.pageYOffset". This is the same pixel value as in IE's "scrollTop", just a different JavaScript reference. Netscape uses "window.pageXOffset" to find the position of the horizontal scrollbar. Pay particular attention to the capitalization of the Netscape offsets. Netscape, too, returns a 0 for a scrollbar that does not exist on a particular page."


In my opinion, it is totally wrong explanation because regardless scrollbar exist or not, the value in "document.body.scrollTop" and in "document.body.scrollLeft" will remain 0 as long as we don't do scroll right or scroll down. The value will be change from 0 to pixel scroll position value if we do scroll right or scroll down.

Now, how do I detect  vertical scrollbar or horizontal scrollbar exist on IE???
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
>> How do I detect  scroll down  or  scroll right  exist on an IE browser page with javascript?

This has been answered.

I'm not sure this question is heading anywhere. You cannot explicitly detect the presence of scrollbars. In case you hadn't noticed, MSIE6 default behaviour is to generate a scrollbar for the body, and textareas where present, whether needed or not.  
0
 

Author Comment

by:wieb18
Comment Utility
So in simple words, there is no other way that we could detect the presence of scrollbars with javascript.
Am I correct?
0
 
LVL 4

Accepted Solution

by:
apprenti earned 125 total points
Comment Utility
Correct.  
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
The answer to the question has been graded C.

I fail to see why, as the answer has been completely answered.

The link to codepunk gives a method of establishing the amount by which a document has been scrolled, and it was confirmed - twice - that there is no way of explicitly detecting scrollbars.

Accordingly, if wieb18 does not regrade the answer, I shall seek regrading myself.
0
 

Author Comment

by:wieb18
Comment Utility
If they are experts then (in my opinion) they must creatively find solutions for any problems.

But in this case, your experts only give me a link to http://codepunk.hardwar.org.uk/ajs02.htm (which previously I had found it using Google) and I knew the explanation in scrollbar detection article in that link is completely wrong. Because regardless scrollbar exist or not, the value in "document.body.scrollTop" and in "document.body.scrollLeft" will remain 0 as long as we don't do scroll right or scroll down.

I ask your expert about this problem (is there any other way to detect scrollbar). Then your expert answered that there is no way of detecting scrollbars.
The answered is very dissapointed me, your expert is not creatively to find some way to solve my problem.

Previously I am not familiar with javascript, but because very dissapointed answered from your expert I had to learn javascript basic to solve my own problem. Then finally I made javascript function by myself to detect the presence of scrollbar.
Here is my own function:

<script language="javaScript">

var winheight = parseInt(document.documentElement.scrollHeight)
var boheight = parseInt(document.body.scrollHeight)
if (winheight >= boheight)
{
document.write("<DIV id='footermenu2'>")
}

else if (winheight < boheight)
{
document.write("<DIV id='footermenu1'>")
}
</script>

As you see, by comparing "document.documentElement.scrollHeight" with "document.body.scrollHeight"  we could detect the vertical scrollbar exist or not.
I ask a question to your expert in hope they could solve my problem, not in the opposite, myself solve my own problem.

So, sorry apprenti I still give you grade C (maybe next time A)
But I love the answered from lil_puffball which I always give she/he grade A because lil_puffball always solve my javascript problem no matter how difficult my question or how long my script.

Sorry for my English.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
>> maybe next time A

Sorry, there won't be a next time unless I receive the appropriate grading for this question.

How does your function detect scrollbars? Which DIV gets shown if scrollbars are present, footermenu1 or footermenu2?
0
 

Author Comment

by:wieb18
Comment Utility
>> Sorry, there won't be a next time unless I receive the appropriate grading

Hahaha.... don't be childish like that and try to be more profesional apprenti, do not make this something personal, no hurt feeling.
Once again, I am very sory that I give you grade C.
I am sure next time you will be much better, we learn from our mistakes, right?

footermenu1 is for horizontal scrollbars if present and footermenu2 if its not present.
Here's the CSS class:

#footermenu1 {
position: fixed;
top: 100%;
right: 0;
bottom: 0;
left: 0;
z-index: 4;
}

#footermenu2 {
position: absolute;
top: 89%;
right: 0;
bottom: 0;
left: 0;
z-index: 3;
}
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
My original replies were concise, accurate, and  had "good qualities in a high degree" (a dictionary definition of 'excellent').

If EE wishes to maintain the integrity of its PAQ base, the answer should be reclassified grade A.

Here's the question wording:

" How do I detect  scroll down  or  scroll right  exist on an IE browser page with javascript?
And how do I detect  the current page has no scroll down  or scroll right?".

(1) The answer in the link provided is sufficient for normal purposes.

wieb18 then stated, 'In my opinion, it is totally wrong explanation because regardless scrollbar exist or not, the value in "document.body.scrollTop" and in "document.body.scrollLeft" will remain 0 as long as we don't do scroll right or scroll down.'

meaning - presumably - wieb18 thinks if the top left of the page is on the screen, document.body.scrollTop should not be zero.

I explained that

(2) it is [em] not possible [/em] to explicitly detect the existence of scrollbars,

and

(3) IE6 produces [em] a vertical scrollbar by default [/em] (right hand side on English language pages).

***********************

>> footermenu1 is for horizontal scrollbars if present and footermenu2 if its not present.

So how does

<script language="javaScript">

var winheight = parseInt(document.documentElement.scrollHeight)
var boheight = parseInt(document.body.scrollHeight)
if (winheight >= boheight)
{
document.write("<DIV id='footermenu2'>")
}

else if (winheight < boheight)
{
document.write("<DIV id='footermenu1'>")
}
</script>

detect horizontal scrollbars?

And you're writing out the opening tag (only) of a DIV. What is supposed to happen then?


0
 

Author Comment

by:wieb18
Comment Utility
>> footermenu1 is for horizontal scrollbars if present and footermenu2 if its not present.

Sorry, I mean vertical scrollbar, the right statement is "footermenu1 is for vertical scrollbars if present and footermenu2 if its not present."

>> IE6 produces [em] a vertical scrollbar by default [/em] (right hand side on English language pages).

In my opinion, IE6 not produces a vertical scrollbar by default. IE6 will produces a vertical scrollbar if the lenght of page is too long than the height of inner browser. If the lenght of page is too short than the height of inner browser, IE6 not produces a vertical scrollbar.

I need to detect scrollbar because I want to lay footermenu at the browser bottom and by comparing document.documentElement.scrollHeight and document.body.scrollHeight we could detect the present of vertical scrollbar (not the horizontal scrollbar, sorry).

If the vertical scrollbar present (because the lenght of page is too long than the height of inner browser) then I lay my footermenu at browser bottom (top: 100%).
If the vertical scrollbar not present (because the lenght of page is too short than the height of inner browser) then I need to lay my footermenu at browser bottom by deducting height of inner browser with height of the page (top: 89% - because my page only 10% height).

About grading, please read: http://www.experts-exchange.com/help.jsp#hi73
>> if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option
>> If a possible solution is incomplete - ask for clarification or details before accepting the answer and grading it.

I already made a clarification to you.
>> So in simple words, there is no other way that we could detect the presence of scrollbars with javascript.
>> Am I correct?

Because I think your answer is lack finality or do not completely address the issue presented, then I give you C grade (sorry).
If at that time, your answer is like lil_puffbal
(http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20974680.html - Accepted Answer from lil_puffball  Date: 05/03/2004 01:15PM PDT)
I will give you A grade because you give me other options of possible ways to solve my problem.

BTW, I think grading judgment is my privilege as EE premium services member as long as I am give fair grading and could explain the reason of my grading.
And in my opinion, I am already give fair grading in this case.

Sorry, I am not too good in English - especially in grammar, hope you understand what I mean.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
Grading must not be exercised incorrectly or maliciously, which is what has happened here.

So I will not be answering any further questions from you. Whether I continue to participate on this site depends on whether the accurate, concise, and final answer already provided is given the appropriate grading (A) it merits.

Your opinion is of no interest. Only facts are of interest. It is a fact that IE6 produces a dead vertical scrollbar by default. Your 'function' (actually not a function) will not detect its presence accurately. If the page is restored down, creating live scrollbars, your 'function' will not detect their presence accurately.

Q.E.D.

You have just travelled from Hammersmith to St Paul's via Heathrow, JFK, LAX, and LCY. I prefer the direct route.

0
 

Author Comment

by:wieb18
Comment Utility
If the direct route is not available, why you don't  travell from Hammersmith to St Paul's via Heathrow, JFK, LAX, and LCY?
The important is we could reach the purpose using all possible alternatives.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
If the grading is not changed to A, I will quit answering questions, period.

Because the correct grade is A.
0
 

Author Comment

by:wieb18
Comment Utility
>> Because the correct grade is A.

Hahaha.... still not profesional, if you less arogan maybe I will compromise following the sugestion from Netminder.

But, why I have to compromise with you, I solve my own problem, I found all the answer by myself (with lil_puffball little tips), and you give me nothing, only a link to http://codepunk.hardwar.org.uk/ajs02.htm (which previously I had found it using Google).

So, the correct grade is still C.


>> If the grading is not changed to A, I will quit answering questions

Don't forget, I could bluffing either like you:   "If the grading is not still C, I will quit from EE Premium Services Membership"
How about that.  :)


0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
wieb18 if your function works I am tottally with you. For an 'expert' to say it can't be done and then the questioner goes off and solves it proving that it can in fact be done means that the experts answer was 'wrong' or a least not entirely accurate.

Also, I don't go for this 'expert' thing. The whole community is user to user.  I never whine about a grade because for me the 'points' are simply an instrument to encourage people to answer questions and receive some form of feedback. Are people selling points? Whats the big deal?

Anyway I need to detect the presence of a vertical scrollbar so that I can increase the size of a vertical div accordingly so I am going to try your function, it looks sound on first glance.
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
wieb18 Thank you your function works perfectly. In my situation I have a two frame page. the left frame contains an expandable menu. I added a vertical div that lines up on the right side of the menu frame it's 10px wide and has a textured grey background. When the user click on this div it collapses the entire menu frame to just wide enough to show the div so that it can be clicked again it expands the menu frame back to its previous size.

lol That's the long way of saying it's a hideable menu frame.

So my problem was that it was collapsing the frame to 10px, but if the menu was expanded verticaly far enough that the vertical scroll bar was visible, then when I collapsed the frame the scroll bar covered up my clickable div and there was nothing to click to restore the frame.  I simply used your function to detect if the vertical scroll bar was present and if so only collapse the frame to 30px instead of 10px.

Works like a charm.

I think the actions of Netminder and apprenti only encourage people to provide simplestic answers and then get full marks just for trying.  Like help desk tech's that only know how to say "Have you tried rebooting" lol.

Considering that the question was actualy answered INCORRECTLY apprenti should have been happy to get a C.

Cheers All



0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
[apprenti]
wieb18 then stated, 'In my opinion, it is totally wrong explanation because regardless scrollbar exist or not, the value in "document.body.scrollTop" and in "document.body.scrollLeft" will remain 0 as long as we don't do scroll right or scroll down.'

meaning - presumably - wieb18 thinks if the top left of the page is on the screen, document.body.scrollTop should not be zero.
[/apprenti]

No meaning that if you can have a visible scrollbar AND document.body.scrollTop can still be zero therefor it does NOT test for a visible scrollbar.

It's these small injustices in the world that are really hard to shake. :)

wieb18 again thank you for your excellent solution if you would like I can post my own question so you can have some points for it..with an A :)

Cheers
Dave
0
 

Author Comment

by:wieb18
Comment Utility
Thank you for using my simple function and supporting me, Dave.

I am not 'expert' like apprenti or Netminder, I am just regular user and I do not want to have some points or A grade.
It is enough for me if my simple function finally usefull for someone, but thanks anyway for the offer.
Glad to help you, Dave.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
>> wieb18 if your function works I am tottally with you.

It (a) doesn't 'work' (if that means 'detect scrollbars reliably'), and (b) isn't a function.

>> No meaning that if you can have a visible scrollbar AND document.body.scrollTop can still be zero therefor it does NOT test for a visible scrollbar.

Who said that it did test for a visible scrollbar? Look for the following text above:

"You cannot explicitly detect the presence of scrollbars. In case you hadn't noticed, MSIE6 default behaviour is to generate a scrollbar for the body, and textareas where present, whether needed or not."  

>> In my opinion, IE6 not produces a vertical scrollbar by default.

Here's the test:

<html lang="en">
<body>Opinion?</body></html>
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
My summation of this thread is that a member had a feature he wanted to use but it required detecting if the scroll bar was visible on the client or not. Your answer was that it can't be done. The member figured out a creative yet simply solution (detecting the condition that causes it to show rather then detecting it directly.)  Thus solving his and my probelm. I am using his concept wrapped in a function called isVBar() works like a charm reliably and is already in use on one of my production sites. Not sure why you say it doesn't work. Perhaps you misunderstood the requirement from the beginning.

For some reasons the member decided to generously give give you a C for your effort regardless of the fact that you were wrong or at least not entirly correct or helpfull.  For some unknown reason instead of simply saying "Gee good idea!" You whined that didn't get an "A" for some other inexplicable reason the forum moderator agreed with you which confuses me to no end they must have been overworked.

Not sure why I am wasting my time on this thread perhaps it is because your behavior so offends my sensibilities of fair play.

As they say to proof is in the pudding. Here is a quickie sample page using wieb18's method that detects the presence of the vertical scrollbar both when the window is resized or when an element within the document grows or shrinks.

http://www.lonecrow.net/coarto/test_vbar.asp

Only tested on ie5 and ie6 (these arn't billable hours after all)

Anyway as that sample should demonstrate, his solution works fine. If I were in your shoes I would apologise for whinning about your grade. No fault in not finding the solution yourself. But very bad taste not to recognize weib18's excellent solution.

imho I find that weib18's tone has been polite and proffesional, whereas your tone has been much less so.

Dave
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:wieb18
Comment Utility
I have seen your isVBar function on http://www.lonecrow.net/coarto/test_vbar.asp  and it seem  "works like a charm" ... ;-D
Once again, thank you very much for supporting me Dave.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
>> My summation of this thread is that a member had a feature he wanted to use

The "feature he wanted to use" is not mentioned in the question at all. Here's the text (04/26/2004 05:59PM GMT):

>> How do I detect  scroll down  or  scroll right  exist on an IE browser page with javascript?
And how do I detect  the current page has no scroll down  or  scroll right?

*************

>> but it required detecting if the scroll bar was visible on the client or not.

wieb18 gave no details whatever of the "feature" (s)he wanted to use until 05/03/2004 03:41PM GMT. It turned out wieb18 wanted to detect when page contents extended below the fold, not the presence of scrollbars.

Which is, needless to say,  a different question altogether.

So wieb18's grading was for a question s(he) didn't ask.

It's possible the grade C might be appropriate for my mindreading ability, or (at a stretch) wieb18's ability to succinctly explain his/her requirement.

***********

<html lang="en">
<body>Opinion?</body></html>

Scrollbar in MSIE6? Oui ou non?
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
I suppose it is possible for someone to misread weib18's first post. However I understood by the "exist" to mean is the bloody thing there, not has the user used it. :)

In any case after you posted the link wieb18 did make it clear that they didn't want to know if the user scrolled but whether the scroll bar existed. I found the last line in their second post to be very clear.
 
Date: 04/27/2004 07:45AM PDT
>>Now, how do I detect  vertical scrollbar or horizontal scrollbar exist on IE???

I little harder to mis-read that isn't it?

*****************
<html lang="en">
<body>Opinion?</body></html>

"Non".  Are you trying to make the case that the scroll bar 'exists' but is not active or something?  To which I suppose I could reply pedantically "no the slidy bar does not 'exist' only the greyed out arrows and trough do"
*****************

Look all I am saying is that he/she ended up solving the problem themselves.  So maybe you mis-understood the question, at least you got a C for trying to helpful. But then to go on and complain about your grade?!?  And to compound this bad form you never actualy acknowledged weib18 for their excellent solution to something you said couldn't be done. Whats that about?

Your main arguement for a better grade:
[apprenti]
The link to codepunk gives a method of establishing the amount by which a document has been scrolled, and it was confirmed - twice - that there is no way of explicitly detecting scrollbars.
[/apprenti]

First weib18 had already pointed out in their second post they were not interested in how much a user had scrolled but rather wanted to know if the scrollbar existed.

You may have confirmed twice that the scrollbar can't be detected, but weib18 proved once that it can. So there IS a way of detecting the scroll bar.

Your first answer was off topic and your second answer was wrong as weib18 proved.
e.g. http://lonecrow.net/coarto/test_vbar.asp.

Colour me stupid but I fail to see these as arguements for an "A".  

[apprenti]
It (a) doesn't 'work' (if that means 'detect scrollbars reliably')
[/apprenti]

Please, if you can describe for me the conditions under which my supplied example using weib18's method does not work reliably I will thank you graciously and post a 100pt question for your time. Since I have this working on one of my production sites I'd like to handle any exceptions I didn't forsee.

As a final word from me I guess you were standing on principal that you made a good faith effort to answer the question as you understood it and you felt that weib18 was being unfair.  I am simply standing up for the principal that weib18 was being fair in assigning you a C for your time regardless of the fact that your one answer was off topic and the other was wrong.  

If this situation wasn't so trivial I guess I should be hauranging netminder as well :)


0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
*****************
<html lang="en">
<body>Opinion?</body></html>
*****************

In my case it is the vertical scroll bar between two frames where "scrollbars=auto".   In this situation there is nothing at all until the document body is higher then the window height.

So in all fairness it was allot easier for me to understand what weib18 was asking because I was faced with a similair situation and was reading it in that direct context.

Ok I guess I can let go of this now, I have offered my opinion.

0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
I can't believe the number of cross browser issue's I get between IE 6.0.28 running on win2000 compared to IE 6.0.28 running on WinXP.

It works flawlessly on ie 5+ on win2k so I'll have to test it on one of my win2003 servers which should mimic winXP fairly enough.
Hmm I don't want to edit my firewall to allow browser out on the server, I'll have to install XP on one of my home machines.

Well we don't care about the inactive default scrollbar because I beleive if you check the available width you'll end up within the left side of the "scroll bar area".  Mostly concerned with times when the scrollbar appears and suddenly shrinks the available width. So any elements positioned absolutely on the right side of the screen can be adjusted to still be visible.

So I wonder which value or event is not correct when on XP. Is the onResize event firing?  I updated the script to also report the values of the two heights perhaps that will help debug it on XP.

I'll go look up scrollHeight on XP issues.



0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
Can't find any references to compatibility issues between IE on XP and win2k but I know there are several. I posted a mesage at http://www.quirksmode.org/  because I expected to see some reference there.

In the mean time, I'll have to get on the phone to a friend running XP to assit in the debug, Im not about to rebuild a machine today just to test this.

If you think you know which value is reporting different or which event is not firing the same let me know.

Cheers

0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
I remoted into one of my clients XP servers that I configured to allow browser out.

It is running win2003 and IE 6.0.37.... and the script performs as expected. When the window is resized causing the vbar to "activate" the script reports "Yes" or when the div is expanded to activate the vbar it reports "Yes".

Hmmm...I was kinda hoping that XP and 2003 shared the same behaviors so I could use it for XP testing. I guess not.

The win2003 was set to use classic interface not the new XP interface. ( I like to call it the "Fisher Price" interface :)

I don't suspect that would make a difference to DOM calls but ya never know.

If you have any ideas I'd love to hear them. I don't suppose you are running other Windows OS's so you could test between the two.

0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
lol will do netMinder, I first have to nail down this XP issue.

I heard back from PPK at quirksmode.org already. He says the test page worked for him but that he doesn't have win2k.  He didn't mention if he was using win2003 or XP tho :(

He asked that if we figure out the exact compatibility issue , if there is one, he would liek to link to it.

maybe I will install winXP after all....
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
As luck would have it a friend just called and he is running XP in "new interface mode" with ie 6.0.28 and the script functioned as expected reporting the correct state of the vbar.  Both when clicking the div to expand the body or when resizing the window.

?? Any ideas why it does not appear to work on yours?

He was using:
IE 6.0.2800 update sp1
XP sp2
0
 

Expert Comment

by:PerMagne
Comment Utility
Just want to add my support to wieb18!

I was also looking for a way to detect the horizontal scrollbar. The link by Apprenti gives me no information on how to solve this problem. He later confirms that "there is no other way we could detect the presence of scrollbars with javascript". Which is simply wrong. I also find his 'answers' to be made in a somewhat negative tone.

Wieb18 refuses to accept this answer, and finds a way to work around and detect it anyway. A workaround, yes. But that's the norm with javascript anyway.

I do not know the grading policies, but I assume that for a wrong answer, C would be appropriate. With the admin raising this grade to a B, I get a feeling they are 'adjusting' the quality of their experts, and get less incentive to pay for a service here later.

Wieb18 have presented the solution to my problem. Thank you!
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
>> I do not know the grading policies, but I assume...

Experts Exchange now has a new Grading Guru.

But unfortunately, the Guru hasn't even bothered to read the grading guidelines.
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
?? Any ideas why it does not appear to work on yours?

apprenti, I havn't been able to find any yet who was able to replicate the mis-detection that you were able to find. I would truly like to find out what the conditions were.  Was there a paticular sequence that you followed?





0
 

Author Comment

by:wieb18
Comment Utility

>> But unfortunately, the Guru hasn't even bothered to read the grading guidelines

We all have read the grading guidelines on  http://www.experts-exchange.com/help.jsp#hi73
>> if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option

And we all agree, Apprenti answers are lack finality or do not completely address the issue presented, then a "C" grade would be appropriate.
Thank you for supporting me, PerMagne.

Chisholmd, don't bother and wasting your time on mis-detection issue .
I have check your VBar function with XP and the script functioned as expected.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
>> We all have read the grading guidelines

Wrong (again).  PerMagne stated (s)he did not know the grading policies, so obviously had not read  http://www.experts-exchange.com/help.jsp#hi73.

>> Apprenti answers are lack finality or do not completely address the issue presented

The issue "presented" - detecting if content extended below the fold - wasn't actually "presented" at all, until after wieb18 had closed the question and graded the answer C.

***************

My interpretation of

Q1) "How do I detect  scroll down  or  scroll right  exist on an IE browser page with javascript?"

was:

A1. the amount of page scroll down is read from scrollTop property (etc)

and

Q2) "And how do I detect  the current page has no scroll down  or  scroll right?"

A2. Well, if the page hasn't been scrolled down, scrollTop will be 0 (etc)

seems quite reasonable. I note that probably because of the imprecision and bad English of the original question, no-one else bothered to answer it.

***************

>> Look all I am saying is that he/she ended up solving the problem themselves.

Well, try out wieb18's submission and check if it does what (s)he says it does.

<style type="text/css">
#footermenu1 {
position: fixed;
top: 100%;
right: 0;
bottom: 0;
left: 0;
z-index: 4;
}

#footermenu2 {
position: absolute;
top: 89%;
right: 0;
bottom: 0;
left: 0;
z-index: 3;
}
</style>

<body><span>Don't forget to restore the page down, etc. and alter the amount of content in this span. Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body  Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body  Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body  Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body Body  <br />
</span><script language="javaScript">

var winheight = parseInt(document.documentElement.scrollHeight)
var boheight = parseInt(document.body.scrollHeight)
if (winheight >= boheight)
{
document.write("<DIV id='footermenu2'>footermenu2. Correct footer in the correct position?</DIV>")
}

else if (winheight < boheight)
{
document.write("<DIV id='footermenu1'>footermenu1. Correct footer in the correct position?</DIV>")
}
</script>
</body>


***************

>> Are you trying to make the case that the scroll bar 'exists' but is not active or something?  

<style type="text/css">
body {scrollbar-face-color:orange}
</style>
<body>wieb18: "In my opinion, IE6 not produces a vertical scrollbar by default."</body>

No case-making required.
0
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
lol ok I surrender. I totally misunderstood the question and the solution does not work. I guess I'd better remove the feature from my web site before all my satisifed users fall into the same pit of bad logic assuming that simply because the functionality works that the code is valid.  Sooner or later they will see that at a fundemental level the code is flawed because I named the function isVBar() instead of isVerticalBarActive() or
isBodyHeightGreaterThenWindowHeight() or
isUserAbleToScrollDownEvenIfAtThisTimeTheyHaveNot()

I am sure that sooner or later a keen eyed hair splitting user who views the source will notice the lazy vocabulary and deem my site sloppy and not worthy of their patronage.

I re-read wieb's second post and your right he didn't clarify what he was looking strongly enough, for although he states that the information in the link did not apply to his question and that he is not interested in determining has the user scrolled, but rather IF the user can scroll, his three paragraphs of explanation should have explained his question in simple langauge using smaller words so that everyone could understand.

I suppose weib is in the same prediciment as myself for although he has deployed the solution and it appears to work and stand up to testing it in fact does not work because you say so.

Weird!!  as I was typing the scrollbar on the side of this edit box suddenly experienced a state change! It went from a lifeless greyed out thing to an active thing with a little slidy dohicky in it...I wonder what we should call this new state?


0
 

Expert Comment

by:PerMagne
Comment Utility
>> Wrong (again).  PerMagne stated he did not know the grading policies, so obviously had not read

Ahem. That's wrong.
Indeed, I do not know the grading policies. That's because I haven't graded many questions, nor discussed my various gradings with several other people, and not even cleared difficult issues with borderline gradings yet. I will not write that "I know" the grading policies until I have definite knowledge about them, and also know that my view matches the majority of other people on this site.

I did, however, read those grading guidelines, and it seemed to me that a "C" would be appropriate. If I had not read those, I would have give a school-type "F".

Apprenti, it seems to me that you are a little bit too rigid when reading our posts. Granted, both my post above, and the initial question by wieb, could have been written better to convey our meanings. But in both cases, things could have been much more smooth if you had just asked for more details. It seems to me that if you are missing complete information, you will assume something, then turn quite agressive and refuse to change your assumption.

>>Comment from wieb18
>>So in simple words, there is no other way that we could detect the presence of scrollbars with javascript.
>>Am I correct?

>>Accepted Answer from apprenti
>>Correct.

He did certainly clearify that he wants to "detect the _presence_ of scrollbars", not the amount scrolled. His question also implies that a workaround would be fine.
Your answer is wrong.
0
 

Author Comment

by:wieb18
Comment Utility
>> Sorry for my English.
>> I am not too good in English - especially in grammar, hope you understand what I mean.

Many times I written in my posts that I am so sorry with my bad English because I know my English is not good as you are, guys.
But I try hard to make my posts clearly and not mis-interpretation.
And if it is not clearly enough, why anyone did not ask me for more details?

>> have explained his question in simple langauge using smaller words
>> could have been written better to convey our meanings

Now I know, it seems everybody understand the meanings of my question, except apprenti.
Thanks guys.
0
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
PerMagne (05/21/2004 10:34AM GMT): "I do not know the grading policies".

PerMagne (05/28/2004 07:16AM GMT): "I did, however, read those grading guidelines"

***********

PerMagne (05/21/2004 10:34AM GMT): "Wieb18 refuses to accept this answer"

PerMagne (05/28/2004 07:16AM GMT):
"  >>Accepted Answer from apprenti"

***********

PerMagne  (05/21/2004 10:34AM GMT): "I was also looking for a way to detect the horizontal scrollbar."

apprenti (Date: 05/04/2004 12:29PM GMT):
"So how does

<script language="javaScript">

var winheight = parseInt(document.documentElement.scrollHeight)
var boheight = parseInt(document.body.scrollHeight)
if (winheight >= boheight)
{
document.write("<DIV id='footermenu2'>")
}

else if (winheight < boheight)
{
document.write("<DIV id='footermenu1'>")
}
</script>

detect horizontal scrollbars?"

web18 (05/04/2004 02:31PM GMT)
"Sorry, I mean vertical scrollbar..."

***********

wieb18(05/28/2004 12:13PM GMT): "Now I know, it seems everybody understand the meanings of my question, except apprenti."

"Everybody", in this case, apparently meaning David Blaine and Mystic Meg.

0
 

Author Comment

by:wieb18
Comment Utility
>> "Everybody", in this case, apparently meaning David Blaine and Mystic Meg

Hua ... ha .. ha .. ha ...
Apprenti, I think you are a very funy person that I have ever met on internet.
From your attitude, I think you are a female, right?
Sorry if I am wrong.

BTW, my real name is Anton.
Very nice to meet you, apprenti.
0
 

Expert Comment

by:PerMagne
Comment Utility
Sorry, Apprenti, your arguments are inane. You are picking up irrelevant information and making a big issue of it. Stick to the point and skip the rest.

The point here is:
You gave an incorrect answer after sufficient information about the matter was provided.

From what wieb posted, I could create the feature I wanted. Which was the same as wieb's initial question. Since he did manage to answer the question, your answer is wrong.

Wieb have gotten positive feedback from two other users, which certainly proves his solution is able to solve this problem. If the scrollbar at the botton is called horizontal, or just looks horizontal, is utterly irrelevant.

*** Off-topic remarks edited by Netminder, Site Admin ***
0
 

Expert Comment

by:thedp
Comment Utility
apprenti acts like a child and the moderator gives him a prize.
Now that's professional!!!

apprenti, get a life!
Or at least answer correctly.
0
 
LVL 14

Expert Comment

by:sam2912
Comment Utility
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now