
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
responsive-toolkit
Advanced tools
Responsive Bootstrap Toolkit provides an easy way of breakpoint detection in JavaScript, detecting changes in currently active breakpoint, as well as executing any breakpoint-specific JavaScript code. Despite the name, you can use it also with Foundation,
Responsive Bootstrap Toolkit provides an easy way of breakpoint detection in JavaScript, detecting changes in currently active breakpoint, as well as executing any breakpoint-specific JavaScript code. Despite the name, you can use it also with Foundation, or any other framework.
Current version: 2.6.1
Using Bower:
bower install responsive-toolkit
Using NPM:
npm install responsive-toolkit
Live example available on CodePen. Hosted along with repository are the following usage examples:
// Wrap IIFE around your code
(function($, viewport){
$(document).ready(function() {
// Executes only in XS breakpoint
if(viewport.is('xs')) {
// ...
}
// Executes in SM, MD and LG breakpoints
if(viewport.is('>=sm')) {
// ...
}
// Executes in XS and SM breakpoints
if(viewport.is('<md')) {
// ...
}
// Execute code each time window size changes
$(window).resize(
viewport.changed(function() {
if(viewport.is('xs')) {
// ...
}
})
);
});
})(jQuery, ResponsiveBootstrapToolkit);
Allows using custom debounce interval. The default one is set at 300ms.
$(window).resize(
viewport.changed(function() {
// ...
}, 150)
);
$(window).resize(
viewport.changed(function() {
console.log('Current breakpoint: ', viewport.current());
})
);
Instead of Bootstrap's aliases xs
, sm
, md
and lg
, Foundation uses: small
, medium
, large
, and xlarge
.
(function($, viewport){
viewport.use('Foundation');
if(viewport.is('small')) {
// ...
}
})(jQuery, ResponsiveBootstrapToolkit);
Note: Currently, only Foundation 5 visibility classes are supported. If you'd like to support older version of any framework, or provide your own visibility classes, refer to example below.
(function($, viewport){
var visibilityDivs = {
'alias-1': $('<div class="device-alias-1 your-visibility-class-1"></div>'),
'alias-2': $('<div class="device-alias-2 your-visibility-class-2"></div>'),
'alias-3': $('<div class="device-alias-3 your-visibility-class-3"></div>')
};
viewport.use('Custom', visibilityDivs);
if(viewport.is('alias-1')) {
// ...
}
})(jQuery, ResponsiveBootstrapToolkit);
Note: It's up to you to create media queries that will toggle div's visibility across different screen resolutions. How? Refer to this example.
Paste just before </body>
<!-- Responsive Bootstrap Toolkit -->
<script src="js/bootstrap-toolkit.min.js"></script>
<!-- Your scripts using Responsive Bootstrap Toolkit -->
<script src="js/main.js"></script>
Refer to the changelog for a list of changes in each version of the library.
FAQs
Responsive Bootstrap Toolkit provides an easy way of breakpoint detection in JavaScript, detecting changes in currently active breakpoint, as well as executing any breakpoint-specific JavaScript code. Despite the name, you can use it also with Foundation,
The npm package responsive-toolkit receives a total of 3,541 weekly downloads. As such, responsive-toolkit popularity was classified as popular.
We found that responsive-toolkit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.