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

Add breakpoint change callbacks? #17

Open
SaFrMo opened this issue Mar 31, 2017 · 1 comment
Open

Add breakpoint change callbacks? #17

SaFrMo opened this issue Mar 31, 2017 · 1 comment
Labels

Comments

@SaFrMo
Copy link
Contributor

SaFrMo commented Mar 31, 2017

The site I'm working on now needs JS to run if the user resizes past certain breakpoints, and so have a couple other sites I've worked on. Should we add something like this to the onResize function?

// Breakpoint change callbacks
        switch(true){

            // increasing width
            case old.width < 750 && site.winWidth >= 750:
                console.log('mobile to laptop');
                break;
            case old.width < 1200 && site.winWidth >= 1200:
                console.log('laptop to desktop');
                break;
            case old.width < 1800 && site.winWidth >= 1800:
                console.log('desktop to cinema');
                break;

            // decreasing width
            case old.width >= 1800 && site.winWidth < 1800:
                console.log('cinema to desktop');
                break;
            case old.width >= 1200 && site.winWidth < 1200:
                console.log('desktop to laptop');
                break;
            case old.width >= 750 && site.winWidth < 750:
                console.log('laptop to mobile');
                break;

        };
@drewbaker
Copy link
Member

drewbaker commented Mar 31, 2017 via email

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

2 participants