Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript easy resize for screen size

//https://cdnjs.cloudflare.com/ajax/libs/enquire.js/2.1.6/enquire.min.js

// this code allows for an Obj instance to run methods on - to call code when a screen change occurs
class ScreenSize{

    addCSS(maxOrMin, screenSize, element, style, change){
     enquire.register("screen and ("+maxOrMin+"-width: "+screenSize+")", ()=>{    
       document.querySelector(element).style[style] = change;
    });
  }
}
 
PREVIOUS NEXT
Tagged: #javascript #easy #resize #screen #size
ADD COMMENT
Topic
Name
4+9 =