{"id":21620192,"url":"https://github.com/maciej-gurban/responsive-bootstrap-toolkit","last_synced_at":"2025-05-16T14:06:41.474Z","repository":{"id":17676466,"uuid":"20481280","full_name":"maciej-gurban/responsive-bootstrap-toolkit","owner":"maciej-gurban","description":"Responsive Bootstrap Toolkit allows for easy breakpoint detection in JavaScript","archived":false,"fork":false,"pushed_at":"2022-04-29T09:39:45.000Z","size":77,"stargazers_count":363,"open_issues_count":2,"forks_count":88,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-05T05:36:46.915Z","etag":null,"topics":["breakpoint","javascript","responsive","responsive-layout"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maciej-gurban.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-04T11:48:12.000Z","updated_at":"2024-10-07T04:43:36.000Z","dependencies_parsed_at":"2022-09-03T08:32:59.812Z","dependency_job_id":null,"html_url":"https://github.com/maciej-gurban/responsive-bootstrap-toolkit","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciej-gurban%2Fresponsive-bootstrap-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciej-gurban%2Fresponsive-bootstrap-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciej-gurban%2Fresponsive-bootstrap-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciej-gurban%2Fresponsive-bootstrap-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maciej-gurban","download_url":"https://codeload.github.com/maciej-gurban/responsive-bootstrap-toolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253724755,"owners_count":21953908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breakpoint","javascript","responsive","responsive-layout"],"created_at":"2024-11-24T23:10:51.224Z","updated_at":"2025-05-16T14:06:41.427Z","avatar_url":"https://github.com/maciej-gurban.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Responsive Bootstrap Toolkit\n\nResponsive 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.\n\nCurrent version: **2.6.3**\n\n### Documentation\n* [Installation](#installation)\n* [Demo](#demo)\n* [Basic usage](#basic-usage)\n* [Execute code on window resize](#execute-code-on-window-resize)\n* [Get alias of current breakpoint](#get-alias-of-current-breakpoint)\n* [Using with Foundation](#using-with-foundation)\n* [Providing your own visibility classes](#providing-your-own-visibility-classes)\n\n### HOW-TO\n* [How do I include it in my project?](#how-do-i-include-it-in-my-project)\n* [Migrating from an older version](#migrating-from-an-older-version)\n* [Dependencies](#dependencies)\n\n### Installation\n\nUsing Bower:\n````\nbower install responsive-toolkit\n````\nUsing NPM:\n````\nnpm install responsive-toolkit\n````\n\n### Demo\n\nLive example available on [CodePen](http://codepen.io/dih/full/ivECj). Hosted along with repository are the following usage examples:\n* [Bootstrap demo](https://github.com/maciej-gurban/responsive-bootstrap-toolkit/tree/master/demos/bootstrap)\n* [Foundation demo](https://github.com/maciej-gurban/responsive-bootstrap-toolkit/tree/master/demos/foundation)\n* [Custom breakpoints demo](https://github.com/maciej-gurban/responsive-bootstrap-toolkit/tree/master/demos/custom)\n\n\n#### Basic usage:\n\n````javascript\n// Wrap IIFE around your code\n(function($, viewport){\n    $(document).ready(function() {\n\n        // Executes only in XS breakpoint\n        if(viewport.is('xs')) {\n            // ...\n        }\n\n        // Executes in SM, MD and LG breakpoints\n        if(viewport.is('\u003e=sm')) {\n            // ...\n        }\n\n        // Executes in XS and SM breakpoints\n        if(viewport.is('\u003cmd')) {\n            // ...\n        }\n\n        // Execute code each time window size changes\n        $(window).resize(\n            viewport.changed(function() {\n                if(viewport.is('xs')) {\n                    // ...\n                }\n            })\n        );\n    });\n})(jQuery, ResponsiveBootstrapToolkit);\n````\n\n#### Execute code on window resize\nAllows using custom debounce interval. The default one is set at 300ms.\n\n````javascript\n$(window).resize(\n    viewport.changed(function() {\n\n      // ...\n\n    }, 150)\n);\n````\n\n#### Get alias of current breakpoint\n````javascript\n$(window).resize(\n    viewport.changed(function() {\n        console.log('Current breakpoint: ', viewport.current());\n    })\n);\n````\n\n#### Using with Foundation\n\nInstead of Bootstrap's aliases `xs`, `sm`, `md` and `lg`, Foundation uses: `small`, `medium`, `large`, and `xlarge`.\n\n````javascript\n(function($, viewport){\n\n    viewport.use('Foundation');\n\n    if(viewport.is('small')) {\n        // ...\n    }\n\n})(jQuery, ResponsiveBootstrapToolkit);\n````\n\n**Note:**\nCurrently, 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.\n\n#### Providing your own visibility classes\n\n````javascript\n(function($, viewport){\n\n    var visibilityDivs = {\n        'alias-1': $('\u003cdiv class=\"device-alias-1 your-visibility-class-1\"\u003e\u003c/div\u003e'),\n        'alias-2': $('\u003cdiv class=\"device-alias-2 your-visibility-class-2\"\u003e\u003c/div\u003e'),\n        'alias-3': $('\u003cdiv class=\"device-alias-3 your-visibility-class-3\"\u003e\u003c/div\u003e')\n    };\n\n    viewport.use('Custom', visibilityDivs);\n\n    if(viewport.is('alias-1')) {\n        // ...\n    }\n\n})(jQuery, ResponsiveBootstrapToolkit);\n````\n\n**Note**:\nIt's up to you to create media queries that will toggle div's visibility across different screen resolutions. How? [Refer to this example](https://github.com/maciej-gurban/responsive-bootstrap-toolkit/blob/master/demos/custom/style.css).\n\n#### How do I include it in my project?\n\nPaste just before `\u003c/body\u003e`\n\n````html\n\u003c!-- Responsive Bootstrap Toolkit --\u003e\n\u003cscript src=\"js/bootstrap-toolkit.min.js\"\u003e\u003c/script\u003e\n\u003c!-- Your scripts using Responsive Bootstrap Toolkit --\u003e\n\u003cscript src=\"js/main.js\"\u003e\u003c/script\u003e\n````\n\n### Migrating from an older version\n\nRefer to the [changelog](https://github.com/maciej-gurban/responsive-bootstrap-toolkit/blob/master/CHANGELOG.md) for a list of changes in each version of the library.\n\n#### Dependencies:\n* jQuery\n* Bootstrap's responsive utility css classes (included in its standard stylesheet package)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciej-gurban%2Fresponsive-bootstrap-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciej-gurban%2Fresponsive-bootstrap-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciej-gurban%2Fresponsive-bootstrap-toolkit/lists"}