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

small bug in full-width option #4

Open
inbetweencode opened this issue Jan 25, 2017 · 2 comments
Open

small bug in full-width option #4

inbetweencode opened this issue Jan 25, 2017 · 2 comments

Comments

@inbetweencode
Copy link

inbetweencode commented Jan 25, 2017

Hi Andrew, very good page builder!

In frontend.js you use this.el.style.width = window.innerWidth + "px";
innerWidth includes the scrollbar.

I first believed changing this to window.clientWidth fixes the problem.
But I had more succes changing to document.body.clientWidth.

This may lead to other issues when the body isn't full-width.

Furthermore, There are some problems with window resizing.

@inbetweencode
Copy link
Author

I've already come to dislike javascript full-width very much... I'll stop using it.

I now just add custom css:
body .site-main.container { max-width:none; margin-right: 0; margin-left: 0; padding-left: 0; padding-right: 0; }

@davidtowoju
Copy link

davidtowoju commented Mar 20, 2017

@christophedejonge @andrew-worsfold
Hi, I was just about to post the same thing @christophedejonge posted when I saw this. I also have a lot of success with document.body.clientWidth and I think it should replace window.innerWidth. I am yet to see how this "may lead to other issues when the body isn't full-width".

This StackOverflows comments explains this well

Unfortunately, window.innerWidth and window.innerHeight fail to take the size of the scroll bar into account. If scroll bars are present, these methods return wrong results for the window size in nearly all desktop browsers. See http://stackoverflow.com/a/31655549/508355 – hashchange

@christophedejonge I am creating a theme with Tailor, please can you explain more on the css workaround. Adding the css above makes the entire site full-width. Thanks

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

No branches or pull requests

2 participants