Last active
April 26, 2018 15:56
-
-
Save levnhub/96ce520200dac5127906d872aba05a80 to your computer and use it in GitHub Desktop.
Pure JS Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Media Queries | |
| function myFunction(x) { | |
| if (x.matches) { // If media query matches | |
| document.body.style.backgroundColor = "yellow"; | |
| } else { | |
| document.body.style.backgroundColor = "pink"; | |
| } | |
| } | |
| var x = window.matchMedia("(max-width: 700px)") | |
| myFunction(x) // Call listener function at run time | |
| x.addListener(myFunction) // Attach listener function on state changes | |
| // Selectize disable input | |
| $('.selectize-single-select.without-input').next().find('div.selectize-input > input').prop('disabled', 'disabled'); | |
| // Fix selects jumping | |
| $('.selectize-dropdown.without-input').each(function () { | |
| // Get dropdown width | |
| var width = parseInt($(this).css('width')); | |
| // Set input width | |
| $(this).siblings('.selectize-input').css('min-width', width + 7 + 'px'); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment