Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web page will not scroll with keys until clicked

Tags:

javascript

css

The website I'm working on will not scroll until somewhere on a page is clicked with the mouse or 'tabbed' through with the tab key.

Is there a simple answer I am over looking?

EDIT- Okay here is a simple bit of javascript I need help with.

I put this bit at the end of the existing javascript file being called

 function setFocus() {
        document.getElementById("#realBody").focus() ;
 }

I put this bit(just the onload part) in the main php file

</head>
<body class="<?php print $classes; ?>" onload="setFocus()">
  <div id="realBody">

This isn't working, if this simple code is usable I'd love some pointers.

I am trying to draw focus to realBody

like image 625
winchendonsprings Avatar asked Oct 18 '25 00:10

winchendonsprings


2 Answers

Perhaps you are focusing on a text field or dropdown menu, and your input (scrolls) are tied to that one control? Are you explicitly calling Focus() on one of the controls on the page?

like image 112
WEFX Avatar answered Oct 20 '25 14:10

WEFX


remove the hash mark '#'.

Or if your using jQuery

 $(function() {
      $('#realBody').focus();
 });
like image 20
Nathan Romano Avatar answered Oct 20 '25 14:10

Nathan Romano