Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make scroll lock optional #155

Open
TiGR opened this issue Jul 8, 2015 · 7 comments
Open

Make scroll lock optional #155

TiGR opened this issue Jul 8, 2015 · 7 comments
Labels

Comments

@TiGR
Copy link
Contributor

TiGR commented Jul 8, 2015

It would be nice if locking scrolling was optional. The problem is, though I can override it with CSS, I can't prevent remodal from adding padding to content element. Or is there a way?

Remodal works well this way, and I am pretty fine with background scrollable.

@TiGR TiGR changed the title Make overflow:hidden on body optional Make scroll lock optional Jul 8, 2015
@vodkabears
Copy link
Owner

body {
  padding-right: 0 !important;
}

@TiGR
Copy link
Contributor Author

TiGR commented Jul 15, 2015

So, it takes this to change the behavior:

body {
    padding-right: 0 !important;
|
.html.remodal-is-locked, body.remodal-is-locked {
    overflow: auto;
}

@ursbraem
Copy link

Hi! Remodal is awesome. On a side note, I put it together with https://github.com/aFarkas/lazysizes and it works flawlessly.

I am struggling with the same behaviour (jumping when lock screen is on, cf. #50 as well). The fix works, but it messes up our layout.

I can simply hack the script and turn off lockScreen(); - but then we have two scrollbars.

As getScrollbarWidth() is already doing some work, would it be possible to somehow avoid that jump there? Maybe by adding some more padding of the width of another scrollbar? I've tried messing with the paddingRight in the JS, but I found no effect.

@vodkabears
Copy link
Owner

As getScrollbarWidth() is already doing some work, would it be possible to somehow avoid that jump there?

Why is 'padding-right' not working for you? lockScreen sets 'padding-right'. If you have absolute or fixed elements try to set it via CSS or get the value of the body padding and set it via JS.

@vodkabears
Copy link
Owner

Another reason, why it does not work for you, can be this line of the code: https://github.com/VodkaBears/Remodal/blob/master/src/remodal.js#L196. I think, it is more correclty to compare $(document).height() and $(window).height().

@TiGR
Copy link
Contributor Author

TiGR commented Sep 4, 2015

padding-right is not a solution when you have centered background image.

@ursbraem
Copy link

ursbraem commented Oct 2, 2015

Hi, I'm sorry, I lost a little track of the issue. I couldn't answer the question why padding-right wasn't working. But it's not doing the job for me. While uncommenting lockscreen() does, I can live with the two scrollbars, see https://www.sturmundbraem.ch/referenzen#forschungsstiftung-strom-und-mobilkommunikation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants