InterviewSolution
Saved Bookmarks
| 1. |
Inline functions vs Anonymous functions in JavaScript |
|
Answer» Get the pixels of the CURRENT document SCROLLED to from the upper left corner of the window, vertically using the pageYOffset property. An example displays the same and returns the pixels: <!DOCTYPE html> <html> <head> <style> div { height: 1300px; width: 1300px; } </style> </head> <BODY> <script> function display() { window.scrollBy(200, 200); alert("pageYOffset pixels = " + window.pageYOffset); } </script> <button onclick="display()" style="position:fixed;">Display</button> <br><br><br> <div> </div> </body> </html> |
|