Feature Request: Find current breakpoint with Javascript
See original GitHub issueIt would be very useful if we could find out what breakpoint is being displayed at the moment with Javascript.
For example:
if( bootstrapBreakpoint() == "xs" ) { // do something } else { // do something }
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:13 (8 by maintainers)
Top Results From Across the Web
How to detect responsive breakpoints of Twitter Bootstrap 3 ...
You can use IntersectionObserver to detect when a <div class="d-none d-?-block"></div> changes visibility (insert your desired breakpoint). Those CSS classes ...
Read more >The 16 JavaScript debugging tips you probably didn't know
When it comes to debugging JavaScript, the faster the better. Here are our top 16 tips for faster and more efficient debugging. Read...
Read more >JavaScript debugging reference - Chrome Developers
Discover new debugging workflows in this comprehensive reference of Chrome DevTools debugging features.
Read more >debugger - JavaScript - MDN Web Docs
The debugger statement invokes any available debugging functionality, such as setting a breakpoint. If no debugging functionality is ...
Read more >Debugging in the browser - The Modern JavaScript Tutorial
Breakpoints · Quickly jump to the breakpoint in the code (by clicking on it in the right panel). · Temporarily disable the breakpoint...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing out though—no plans to add this ourselves.
fwiw, this can be achieved with something like
(not exhaustively tested, so ymmv)
[edit: and for reference, it’s not possible to use
var(--breakpoint-lg)
directly in the query tested bymatchMedia
, asvar()
is not allowed in that context - hence the slightly awkward acrobatics]