Acceptable to Use fixed position on <body>

I’m creating a JavaScript plugin that pops a window up into the middle of the page and provides some functionality. It seems like if I apply position:fixed to the body element while this window is in use makes everything a bit more stable. On computer screens, it prevents scrolling of the page behind the pop up window, and on mobile, it makes the layout not bounce and shift around quite as much.

My question is, is this an acceptable thing to include as part of my plugin? Considering that I need to make this usable for a wide variety of sites/environments, do you see any problems this could cause?

Personally, I would like someone changing my styling for no reason, no matter the functionality.

The thing that you have to watch out for is if any of your content doesn’t fit into the viewers window then it will be unreachable because they won’t be able to scroll to it (because all elements in the body will be fixed including your modal) .

If its just a little message then this shouldn’t be an issue.

It’s actually a small web app that does provide some functionality. It’s more than just a little message, but I am making it responsive, so content getting cut off shouldn’t be an issue. I am a little worried about some people being put off by it changing the styling of their site, even if it does change it back after the app is closed. I have a config section so I think I may make this optional.

Thanks for the replies.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.