1

i want to hide a div when the page fills the screen and there is no need for a scroll bar. But when the page is large and the screen is small and the user needs to scroll down to see all of the page i want to show the div.

Hope you understand my needs, thank you for your help.


*edit (this one not seems to work what am i doing wrong)

<script type="text/javascript">
if($(document).height() > $(window).height()){
$("#scrollTop").show();
}
else {
$("#scrollTop").hide();
}
</script>
phj
  • 123
  • 2
  • 9
  • http://stackoverflow.com/questions/4814398/jquery-check-if-scrollbar-visible-div-with-overflowauto Did you check? – rastafarianmenagerie May 23 '12 at 00:46
  • 1
    Since your're depending on the document being loaded, try wrapping your example script so [jQuery executes it when the document has loaded](http://api.jquery.com/ready/). – Joel Purra May 23 '12 at 01:54

1 Answers1

3
$(document).ready(function() { 
    if($(document).height() > $(window).height()){
        $(".yourDiv").show();
    }
    else {
        $(".yourDiv").hide();
    }
});
GrayB
  • 1,010
  • 8
  • 22
  • sorry this one don't work. see my edit of the post to see what i got right now. – phj May 23 '12 at 01:44
  • Do you maybe also know a way how the div will come back if the screen expends and not longer fills the screen totally but there is a scroll bar needed after the expend of a screen? that would be realy fantastic :) – phj Jun 01 '12 at 00:16