简体   繁体   中英

Prevent main window from scrolling when using the arrow keys on a Facebook Application

I am developing a Facebook canvas application. There are events attached to the arrow keys, however when up or down arrow keys are pressed, the main window (facebook's window) starts to scroll, which is unwanted behavior . The iframe itself has no scrollbars. I am focusing the iframe with the mouse, but still pressing the arrow keys causes the main window to scroll. I've already read this and this thread but nothing works for me.

I've found the solution. Facebook JavaScript SDK has a method scrollTo , which allows you to control the scroll position of the main window - FB.Canvas.scrollTo(0,0); More info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM