Skip to content
a jQuery plugin that adds viewport classes to the body tag
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes 🎊 Added .gitattributes & .gitignore files Jul 13, 2014
.gitignore 🎊 Added .gitattributes & .gitignore files Jul 13, 2014
README.md omg that's a big by-line Jan 6, 2015
yams.viewport.js fix issue with options Sep 19, 2018

README.md

yams.viewport.js

a jQuery plugin that adds viewport classes to the body tag

Summary

Add one of the following classes to the <body> element

  • viewport-xs
  • viewport-sm
  • viewport-md
  • viewport-lg

Requires

  • jQuery

Usage

<script type="text/javascript" src="yams.viewport.js"></script>
<script type="text/javascript">
    // add callbacks before document ready
    $.yams.viewport.addCallback(funcion(viewport) {
		// viewport object schema
		// {
		//     name: name of currently set viewport
		//     width: current window width
		//     height: current window height
		// }
		console.log('viewport is now ', viewport)
    })
</script> 

Notes

  • By default, uses Bootstrap 3.2.x viewport sizes and nomenclature
  • .viewport-xs (default)
  • .viewport-sm (width >= 768)
  • .viewport-md (width >= 992)
  • .viewport-lg (width >= 1200)
You can’t perform that action at this time.