Giter VIP home page Giter VIP logo

jquery-media-helpers's Introduction

jQuery Media Helper Utilities from jQuery Mobile:

resolution and CSS media query related helpers and behavior

Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.

Demo page:

http://filamentgroup.com/examples/jquery-media-helpers/sample.html

Exposed utilities:

  • orientationchange event from jQuery Mobile

    Handler automatically falls back to resize event in browsers that don't natively support it

    The event object contains an "orientation" property, which will equal either "portrait" or "landscape"

    Examples:

      $(window).bind('orientationchange', function(event){
      	//alert( event.orientation );
      });
    
  • $.mh.media method: pass a CSS media type or query and get a bool return

    Note: this feature relies on actual media query support for media queries, though types will work most anywhere

    Examples:

      $.mh.media('screen') //>> tests for screen media type
      $.mh.media('screen and (min-width: 480px)') //>> tests for screen media type with window width > 480px
      $.mh.media('@media screen and (-webkit-min-device-pixel-ratio: 2)') //>> tests for webkit 2x pixel ratio (iPhone 4)
    
  • Cross-browser media-query width and orientation breakpoint classes

    This script automatically adds classes to the HTML element:

      - "portrait" or "landscape" for orientation
      
      - Min/Max width breakpoint classes for the following widths (by default):
      
      	320px, 480px, 768px, 1024px
      	
      	...which translate to classes that correspond to media query sytnax:
      	
      	.min-width-480px, .max-width-1024px, etc
    

    You can add breakpoints by number or array, like so:

      $.mh.addResolutionBreakpoints( 500 );
      $.mh.addResolutionBreakpoints( [500, 1200] );	
    

jquery-media-helpers's People

Stargazers

 avatar

Watchers

 avatar  avatar

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.