How can I change my Javasscript logic based on breakpoints and element sizes?

Can we have that code where you got stuck? there is a site (gridster.js) which provide useful information related to your question.Please have a look into it.