maciej-gurban / responsive-bootstrap-toolkit

Responsive Bootstrap Toolkit allows for easy breakpoint detection in JavaScript
MIT License
363 stars 89 forks source link

Enhance breakpoint matching functionality #7

Closed hubsmoke closed 9 years ago

hubsmoke commented 9 years ago

Thanks for the tool

I just wanted to note that it'd be nice to allow multiple arguments to viewport.is such as viewport.is('sm', 'xs')

and/or have unary comparison operators like viewport.is('<=sm') and viewport.is('>sm')

maciej-gurban commented 9 years ago

Currently you could go with something like:

switch( viewport.current() ) {
    case 'xs':
    case 'sm': // fall through
        // Code
    break;
}

Your suggestion with passing multiple arguments to is method is quite an interesting one, also because it wouldn't cause any backwards compatibility issues. I'd have to give more thought to it before deciding anything.

lustremedia commented 9 years ago

+1

mikelieser commented 9 years ago

+1

maciej-gurban commented 9 years ago

Requested feature, in the form of parsable unary operators, currently available in Enhanced-breakpoint-matching feature branch at ef803c40462d3671e296ac07e49fe05c1de9d154.

Comments very welcome.

maciej-gurban commented 9 years ago

Functionalities merged into master branch.