I am quite puzzled and still unsure how to explain this in proper words. So far i\'ve used and set up my media queries with Breakpoint. An used Breakpoint-variable looks lik
@Snugug 's answer gives a really good explanation as to why this is happening, and @TusharGupta has a good solution as well that references the mediaquery detected width to javascript. Below solution goes the other way around by using javascript detected width to trigger layout changes.
In case you need to sync mediaqueries with your javascript pixel width detection, one way of approaching the problem is to trigger css layout changes based on classes you add with javascript.
So, instead of writing mediaqueries, write those declarations nested under a class, say:
html.myMobileBP { ... }
And in your javascript/jQuery, add this class like:
if ($(window).width() < myMobileBPPixelSize) {
$("html").addClass("myMobileBP");
}
To drive this even further, you might want to consider lack of javascript support. Define mediaqueries that are furthermore wrapped in a html.no-js
class, then with javascript remove the .no-js
class and apply the above solution of adding breakpoints via javascript classes.