-
Notifications
You must be signed in to change notification settings - Fork 7
/
if-b3-breakpoint.min.js
1 lines (1 loc) · 1.09 KB
/
if-b3-breakpoint.min.js
1
function checkIfBlock(s){return s="block"==$(s).css("display")}function checkSize(){xs=checkIfBlock(".breakpoint-check .visible-xs-block"),sm=checkIfBlock(".breakpoint-check .visible-sm-block"),md=checkIfBlock(".breakpoint-check .visible-md-block"),lg=checkIfBlock(".breakpoint-check .visible-lg-block"),console.clear(),1==xs&&(breakpoint="xs - <480px",console.log(breakpoint),$("body").removeClass("xs sm md lg").addClass("xs")),1==sm&&(breakpoint="sm - ≥768px",console.log(breakpoint),$("body").removeClass("xs sm md lg").addClass("sm")),1==md&&(breakpoint="md - ≥992px",console.log(breakpoint),$("body").removeClass("xs sm md lg").addClass("md")),1==lg&&(breakpoint="lg - ≥1200px",console.log(breakpoint),$("body").removeClass("xs sm md lg").addClass("lg"))}var xs,sm,md,lg,xl,breakpoint;$(document).ready(function(){$("body").append("<div style='visibility:hidden;' class='breakpoint-check'><span class='visible-xs-block'></span><span class='visible-sm-block'></span><span class='visible-md-block'></span><span class='visible-lg-block'></span></div>"),checkSize()}),$(window).resize(function(){checkSize()});