GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - akwebapps/ak-ScreenSizeClass: Grab and assign bootstrap size classes to body tag for stylesheet shortcuts.

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
akScreenSizeClass.js
akScreenSizeClass.js
 
 
akScreenSizeClass.min.js
akScreenSizeClass.min.js
 
 

Repository files navigation

akScreenSizeClass

Grab and assign bootstrap size classes to body tag for stylesheet shortcuts. Sometimes it sucks having to deal with @media classes in your stylesheet. Wouldn't it be easier to reference the size by a class instead?

Initialization & Usage

$.akScreenSizeClass(actionStr,params);
  • actionStr (string; optional)
  • params (obj; optional)

Default Breakpoints & Body Classes

Min Width Max Width Body Class
< 575 .body-xs
576 767 .body-sm
768 991 .body-md
992 1199 .body-lg
1200 > .body-xl

Get Values

var currentClass = $.akScreenSizeClass("class"); //gets the current body class assignment
var currentWidth = $.akScreenSizeClass("width"); //gets the current window width

Reinitialize & Set Body Class

The width is set every time the window is resized but you MAY want to force it to reassign the body class.

$.akScreenSizeClass("set");

Listen for Changes

You can listen for changes. This even will be triggered every time the class is changed.

$(document).on("sizeClassChanged",function(e,data){
   //do something with the data
   //returns {"width":currentScreenWidth,"class":currentBodyClass}
})

Change Breakpoints

Don't like the default breakpoints? You can change them by passing the minimum width of each in the params. If the first parameter actionStr is "set" then the breakpoints will be set for the remainer of the page session.

$.akScreenSizeClass("set",{
	sm: 576,
	md: 768,
	lg: 992,
	xl: 1200
});

About

Grab and assign bootstrap size classes to body tag for stylesheet shortcuts.

Topics

bootstrap-gridstylesheet-shortcutswindow-size

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.