which is the fastest and easy way to fire when bootstrap-responsive.css media queries go in action?
go in action = when you resize window to mobile width and site is changed to responsive mobile
hope question is clear
which is the fastest and easy way to fire when bootstrap-responsive.css media queries go in action?
go in action = when you resize window to mobile width and site is changed to responsive mobile
hope question is clear
Simpler
Using jquery you can find the size of current window and then accordingly do your stuff.
CSS:: Twitter-Bootsrap-layouts
One issue with the other answers is the change event is triggered EVERY resize. This can be very costly if your javascript is doing something significant.
The code below calls your update function only one time, when a threshold is crossed.
To test, grab your window size handle, and drag resize it quickly to see if the browser chokes.
this code add body tag ld, md, sd or xd class
I have prepered a super lightweight library to deal with events fired when window width and Bootstrap breakpoint is changed - responsive-breakpoint-tester
Other features like current breakpoint check are also included:
Bootstrap 4 and Foundation configuraions are supported, more info on GitHub Repository
This works for me in combination with Bootstrap 3:
The hidden DIV change width depending on the actual CSS min-width settings in use. Then my javascript simple check the current with of the DIV.