GithubHelp home page GithubHelp logo

oracle's Introduction

img #Responsive CSS Media Queries for JavaScript

Oracle does not make use of the matchMedia() API but instead retrieves the computed value of a declaired media query via its computed value as being truthy or falsy.

Features:

  • A callback or custom event can be set for truthy or falsy query detection.
  • Mulitple media queries can be set
  • Set the debounce delay when resizing

Examples:

  oracle(
        [{
            media: '@media only screen and (max-width: 40em)',
            truthy: function() {
                updateTruthy(divs[0]);
            },
            falsy: function() {
                updateFalsy(divs[0]);
            },
        }, {
            media: '@media only screen and (min-width: 40.063em) and (max-width: 64em)',
            truthy: function() {
                updateTruthy(divs[1]);
            },
            falsy: function() {
                updateFalsy(divs[1]);
            },
        }]
    );
oracle(
        [{
            media: '@media only screen and (max-width: 640px)',
            truthy: 'truthy-0',
            falsy: 'falsy-0'
        }, {
            media: '@media only screen and (min-width: 641px) and (max-width: 1024px)',
            truthy: 'truthy-1',
            falsy: 'falsy-1'
        }, {
            media: '@media only screen and (min-width: 1025px) and (max-width: 1440px)',
            truthy: 'truthy-2',
            falsy: 'falsy-2'
        }, {
            media: '@media only screen and (min-width: 1441px) and (max-width: 1920px)',
            truthy: 'truthy-3',
            falsy: 'falsy-3'
        }, {
            media: '@media only screen and (min-width: 1921px)',
            truthy: 'truthy-4',
            falsy: 'falsy-4'
        }]
    );

MIT License

Copyright (c) 2016 Julien Etienne

oracle's People

Contributors

julienetie avatar

Watchers

James Cloos avatar  avatar

oracle's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.