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

Different width at different resolution #875

Open
dwsiddall opened this issue Mar 8, 2019 · 0 comments
Open

Different width at different resolution #875

dwsiddall opened this issue Mar 8, 2019 · 0 comments

Comments

@dwsiddall
Copy link

I wish to have the colorbox iframe overlay be 65% width on desktop and 95% width on mobile devices.

I am trying to figure out how to do this. I tried this code, but it didn't work. Am I on the right track?

function myFunction(x) {
if (x.matches) { // If media query matches
colorbox.iframe.width = "95%";
} else {
colorbox.iframe.width = "65%";
}
}
var x = window.matchMedia("(max-width: 400px)")
myFunction(x) // Call listener function at run time
x.addListener(myFunction) // Attach listener function on state changes

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

1 participant