Created
May 4, 2018 01:32
-
-
Save marciofmjr/7d76ed659cceb331acc52e5ad055135f to your computer and use it in GitHub Desktop.
Javascript function that helps to develop responsive, easily showing changes between breakpoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
responsiveHelper([ | |
{size: 1199, label: "xlarge"}, | |
{size: 1049, label: "Large"}, | |
{size: 799, label: "medium"}, | |
{size: 576, label: "small"} | |
]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function responsiveHelper(e){var r=["red","blue","green","pink","purple","yellow"];jQuery("body").append('<div id="responsivehelper"></div>'),jQuery("body").append("<style>.responsivehelper-bar{display:none;}</style>"),jQuery.each(e,function(e,p){var i=p.size,n=p.label;jQuery("body").append("<style>@media screen and (max-width: "+i+"px){.responsivehelper-bar."+n.toLowerCase()+"{display:block;}}</style>"),jQuery("#responsivehelper").append('<div class="responsivehelper-bar '+n.toLowerCase()+'" style="position:fixed; bottom:0; left: 0; width: 100%; height: 30px; line-height:30px; text-align:center; color: #fff; font-size: 30px; background: '+r[e]+"; z-index: "+(999+e)+'; ">'+n+"</div>")})} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment