I was facing the same problem recently - also with Bootstrap 3.
Neither $.width() nor $.innerWidth() will work for you.
The best solution I came up with - and is specifically tailored to BS3 -
is to check the width of a .container
element.
As you probably know how the .container
element works,
it's the only element that will give you the current width set by BS css rules.
So it goes something like
bsContainerWidth = $("body").find('.container').width()
if (bsContainerWidth <= 768)
console.log("mobile");
else if (bsContainerWidth <= 950)
console.log("small");
else if (bsContainerWidth <= 1170)
console.log("medium");
else
console.log("large");